Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 547
Feature: Incremental Append Scan#3512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0064fc9ece2b0fecfa2fbe6d94e48f5e9ade9cb2856a0ef60e382729df00b11acb10f7e1e47af6e4cf3aa7e3f2441d3ee7bfa790317c62377f675ab99dcfb5b4e696cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -395,3 +395,48 @@ | ||
| ) | ||
| spark.sql(f"ALTER TABLE {catalog_name}.default.test_empty_scan_ordered_str WRITE ORDERED BY id") | ||
| spark.sql(f"INSERT INTO {catalog_name}.default.test_empty_scan_ordered_str VALUES 'a', 'c'") | ||
| # Append scan fixture. Snapshots written: | ||
| # 0: append (1, 'a') | ||
| # 1: append (2, 'b') | ||
| # 2: append (3, 'c'), (4, 'b') | ||
| # 3: compact -- rewrites the two letter='b' files into one (operation=replace) | ||
| # 4: delete number=2 | ||
| # 5: append (5, 'd', 100) -- on evolved schema | ||
| # 6: replace table -- lineage break | ||
| spark.sql( | ||
| f""" | ||
| CREATE OR REPLACE TABLE {catalog_name}.default.test_incremental_read ( | ||
| number integer, | ||
| letter string | ||
| ) | ||
| USING iceberg | ||
| PARTITIONED BY (letter) | ||
| TBLPROPERTIES ('format-version'='2') | ||
| """ | ||
| ) | ||
| spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (1, 'a')") | ||
| spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (2, 'b')") | ||
| spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (3, 'c'), (4, 'b')") | ||
| # Compact: letter='b' has two files (from the previous two appends); rewrite them into one. | ||
| # This commits a non-append (replace) snapshot whose rewritten file the append scan must not pick up. | ||
Comment on lines
+421
to
+422
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressing #3512 (review) | ||
| spark.sql( | ||
| f""" | ||
| CALL {catalog_name}.system.rewrite_data_files( | ||
| table => 'default.test_incremental_read', | ||
| options => map('min-input-files', '2') | ||
| ) | ||
| """ | ||
| ) | ||
| spark.sql(f"DELETE FROM {catalog_name}.default.test_incremental_read WHERE number = 2") | ||
| spark.sql(f"ALTER TABLE {catalog_name}.default.test_incremental_read ADD COLUMN extra int") | ||
| spark.sql(f"INSERT INTO {catalog_name}.default.test_incremental_read VALUES (5, 'd', 100)") | ||
| spark.sql( | ||
| f""" | ||
| REPLACE TABLE {catalog_name}.default.test_incremental_read | ||
| USING iceberg | ||
| PARTITIONED BY (letter) | ||
| TBLPROPERTIES ('format-version'='2') | ||
| AS SELECT number, letter, extra FROM {catalog_name}.default.test_incremental_read | ||
| """ | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there are integration tests from java repo, would be good to follow up and replicate the different scenarios to see if the results line up when queried through pyiceberg's api vs spark's