You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "lirui-apache (via GitHub)" <gi...@apache.org> on 2023/07/07 03:30:50 UTC
[GitHub] [iceberg] lirui-apache commented on a diff in pull request #7980: Spark: Allow importing empty tables
lirui-apache commented on code in PR #7980:
URL: https://github.com/apache/iceberg/pull/7980#discussion_r1255200089
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java:
##########
@@ -403,12 +403,12 @@ public static void importSparkTable(
} else {
List<SparkPartition> sourceTablePartitions =
getPartitions(spark, sourceTableIdent, partitionFilter);
- Preconditions.checkArgument(
- !sourceTablePartitions.isEmpty(),
- "Cannot find any partitions in table %s",
- sourceTableIdent);
- importSparkPartitions(
- spark, sourceTablePartitions, targetTable, spec, stagingDir, checkDuplicateFiles);
+ if (sourceTablePartitions.isEmpty()) {
+ targetTable.newAppend().commit();
Review Comment:
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org