|
395 | 395 | ) |
396 | 396 | spark.sql(f"ALTER TABLE {catalog_name}.default.test_empty_scan_ordered_str WRITE ORDERED BY id") |
397 | 397 | spark.sql(f"INSERT INTO {catalog_name}.default.test_empty_scan_ordered_str VALUES 'a', 'c'") |
| 398 | + |
| 399 | + # Fixture for IncrementalAppendScan. Partitioning by `letter` makes the file layout |
| 400 | + # deterministic (one file per partition per insert). The schema is evolved mid-fixture |
| 401 | + # to exercise scans that span the change, and ends with a REPLACE TABLE to break |
| 402 | + # snapshot lineage for the disconnected-snapshots test. |
| 403 | + # |
| 404 | + # Snapshots written: |
| 405 | + # 0: append (1, 'a') |
| 406 | + # 1: append (2, 'b') |
| 407 | + # 2: append (3, 'c'), (4, 'b') |
| 408 | + # 3: delete number=2 |
| 409 | + # 4: append (5, 'd', 100) -- on the evolved schema |
| 410 | + # 5: replace table -- lineage break |
| 411 | + spark.sql( |
| 412 | + f""" |
| 413 | + CREATE OR REPLACE TABLE {catalog_name}.default.test_incremental_read ( |
| 414 | + number integer, |
| 415 | + letter string |
| 416 | + ) |
| 417 | + USING iceberg |
| 418 | + PARTITIONED BY (letter) |
| 419 | + TBLPROPERTIES ('format-version'='2') |
| 420 | + """ |
| 421 | + ) |
| 422 | + spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (1, 'a')") |
| 423 | + spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (2, 'b')") |
| 424 | + spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (3, 'c'), (4, 'b')") |
| 425 | + spark.sql(f"DELETE FROM {catalog_name}.default.test_incremental_read WHERE number = 2") |
| 426 | + spark.sql(f"ALTER TABLE {catalog_name}.default.test_incremental_read ADD COLUMN extra int") |
| 427 | + spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (5, 'd', 100)") |
| 428 | + spark.sql( |
| 429 | + f""" |
| 430 | + REPLACE TABLE {catalog_name}.default.test_incremental_read |
| 431 | + USING iceberg |
| 432 | + PARTITIONED BY (letter) |
| 433 | + TBLPROPERTIES ('format-version'='2') |
| 434 | + AS SELECT number, letter, extra FROM {catalog_name}.default.test_incremental_read |
| 435 | + """ |
| 436 | + ) |
0 commit comments