-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Spark: Allow importing empty tables #7980
Conversation
importSparkPartitions( | ||
spark, sourceTablePartitions, targetTable, spec, stagingDir, checkDuplicateFiles); | ||
if (sourceTablePartitions.isEmpty()) { | ||
targetTable.newAppend().commit(); |
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.
What's the reason of empty commit, instead of say, returning ?
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.
That's what we do for un-partitioned table. And we expect the migration produces a snapshot so that we know the number of migrated files: https://github.com/apache/iceberg/blob/master/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/actions/MigrateTableSparkAction.java#L159
Makes sense, Ill wait to see if any comments, will commit if not. |
@szehon-ho Thanks for reviewing. Do I need to port the change to other spark versions? |
Merged, thanks @lirui-apache , yea I think that would be great , maybe at least 3.3? I think It's voluntary and depends who needs what in each branch. |
Would love to see this ported to 3.2 as well, thanks! Otherwise I can do it. |
Sure I'll open a PR for other spark versions. |
To address #7929.
When a partitioned table is empty, create an empty append commit instead of throwing an exception.