From 87072556d2da1391bc8881386d0cc1870b4bf04d Mon Sep 17 00:00:00 2001 From: ajantha-bhat Date: Fri, 5 Jan 2024 14:29:35 +0530 Subject: [PATCH] Address comments --- .../org/apache/iceberg/spark/BaseFileRewriteCoordinator.java | 4 ++-- .../java/org/apache/iceberg/spark/ScanTaskSetManager.java | 4 ++-- .../src/main/java/org/apache/iceberg/spark/Spark3Util.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/BaseFileRewriteCoordinator.java b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/BaseFileRewriteCoordinator.java index 6f683df2cdf9..5c95475d3302 100644 --- a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/BaseFileRewriteCoordinator.java +++ b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/BaseFileRewriteCoordinator.java @@ -70,12 +70,12 @@ public void clearRewrite(Table table, String fileSetId) { public Set fetchSetIds(Table table) { return resultMap.keySet().stream() - .filter(e -> e.first().equals(Spark3Util.tableUUID(table))) + .filter(e -> e.first().equals(Spark3Util.baseTableUUID(table))) .map(Pair::second) .collect(Collectors.toSet()); } private Pair toId(Table table, String setId) { - return Pair.of(Spark3Util.tableUUID(table), setId); + return Pair.of(Spark3Util.baseTableUUID(table), setId); } } diff --git a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/ScanTaskSetManager.java b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/ScanTaskSetManager.java index b89be92c3a6b..cab40d103171 100644 --- a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/ScanTaskSetManager.java +++ b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/ScanTaskSetManager.java @@ -62,12 +62,12 @@ public List removeTasks(Table table, String setId) { public Set fetchSetIds(Table table) { return tasksMap.keySet().stream() - .filter(e -> e.first().equals(Spark3Util.tableUUID(table))) + .filter(e -> e.first().equals(Spark3Util.baseTableUUID(table))) .map(Pair::second) .collect(Collectors.toSet()); } private Pair toId(Table table, String setId) { - return Pair.of(Spark3Util.tableUUID(table), setId); + return Pair.of(Spark3Util.baseTableUUID(table), setId); } } diff --git a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java index 62c0bff329b5..a781e7b28c3f 100644 --- a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java +++ b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java @@ -950,14 +950,14 @@ public static org.apache.spark.sql.catalyst.TableIdentifier toV1TableIdentifier( return org.apache.spark.sql.catalyst.TableIdentifier.apply(table, database); } - static String tableUUID(org.apache.iceberg.Table table) { + static String baseTableUUID(org.apache.iceberg.Table table) { if (table instanceof HasTableOperations) { TableOperations ops = ((HasTableOperations) table).operations(); return ops.current().uuid(); } else if (table instanceof BaseMetadataTable) { return ((BaseMetadataTable) table).table().operations().current().uuid(); } else { - return null; + throw new UnsupportedOperationException("Cannot fetch table operations for " + table.name()); } }