-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Spark: Change Delete granularity to file for Spark 3.5 #11478
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| package org.apache.iceberg.spark.extensions; | ||
|
|
||
| import static org.apache.iceberg.RowLevelOperationMode.COPY_ON_WRITE; | ||
| import static org.apache.iceberg.RowLevelOperationMode.MERGE_ON_READ; | ||
| import static org.apache.iceberg.TableProperties.COMMIT_MAX_RETRY_WAIT_MS; | ||
| import static org.apache.iceberg.TableProperties.COMMIT_MIN_RETRY_WAIT_MS; | ||
| import static org.apache.iceberg.TableProperties.MERGE_DISTRIBUTION_MODE; | ||
|
|
@@ -56,6 +57,7 @@ | |
| import org.apache.iceberg.Table; | ||
| import org.apache.iceberg.TableProperties; | ||
| import org.apache.iceberg.data.GenericRecord; | ||
| import org.apache.iceberg.deletes.DeleteGranularity; | ||
| import org.apache.iceberg.exceptions.ValidationException; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
|
|
@@ -233,7 +235,6 @@ public void testMergeWithVectorizedReads() { | |
|
|
||
| @TestTemplate | ||
| public void testCoalesceMerge() { | ||
| assumeThat(formatVersion).isLessThan(3); | ||
|
Contributor
Author
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 a miss from my previous PR for writing DVs in V3, instead of skipping this coalesce case when the format version is less than 3, we should be asserting the expected DVs (the else if case below) |
||
| createAndInitTable("id INT, salary INT, dep STRING"); | ||
|
|
||
| String[] records = new String[100]; | ||
|
|
@@ -252,7 +253,9 @@ public void testCoalesceMerge() { | |
| SPLIT_OPEN_FILE_COST, | ||
| String.valueOf(Integer.MAX_VALUE), | ||
| MERGE_DISTRIBUTION_MODE, | ||
| DistributionMode.NONE.modeName()); | ||
| DistributionMode.NONE.modeName(), | ||
| TableProperties.DELETE_GRANULARITY, | ||
| DeleteGranularity.PARTITION.toString()); | ||
| sql("ALTER TABLE %s SET TBLPROPERTIES (%s)", tableName, tablePropsAsString(tableProps)); | ||
|
|
||
| createBranchIfNeeded(); | ||
|
|
@@ -295,6 +298,9 @@ public void testCoalesceMerge() { | |
| // AQE detects that all shuffle blocks are small and processes them in 1 task | ||
| // otherwise, there would be 200 tasks writing to the table | ||
| validateProperty(currentSnapshot, SnapshotSummary.ADDED_FILES_PROP, "1"); | ||
| } else if (mode(table) == MERGE_ON_READ && formatVersion >= 3) { | ||
| validateProperty(currentSnapshot, SnapshotSummary.ADDED_DELETE_FILES_PROP, "4"); | ||
| validateProperty(currentSnapshot, SnapshotSummary.ADDED_DVS_PROP, "4"); | ||
| } else { | ||
| // MoR MERGE would perform a join on `id` | ||
| // every task has data for each of 200 reducers | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -757,7 +757,9 @@ private Map<String, String> tableProperties() { | |
| TableProperties.FORMAT_VERSION, | ||
| "2", | ||
| TableProperties.DEFAULT_FILE_FORMAT, | ||
| format.toString()); | ||
| format.toString(), | ||
| TableProperties.DELETE_GRANULARITY, | ||
| DeleteGranularity.PARTITION.toString()); | ||
|
Comment on lines
+761
to
+762
Contributor
Author
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. This is just the default setup for a table in this test, we do test file scoped deletes as well for this action in |
||
| } | ||
|
|
||
| private void writeRecords(Table table, int files, int numRecords) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.