openinx commented on a change in pull request #3271:
URL: https://github.com/apache/iceberg/pull/3271#discussion_r740031132



##########
File path: flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java
##########
@@ -684,12 +713,139 @@ public void alterPartitionColumnStatistics(ObjectPath 
tablePath, CatalogPartitio
 
   @Override
   public List<CatalogPartitionSpec> listPartitions(ObjectPath tablePath, 
CatalogPartitionSpec partitionSpec)
+      throws TableNotExistException, TableNotPartitionedException, 
CatalogException, PartitionSpecInvalidException {
+    Preconditions.checkNotNull(tablePath, "Table path cannot be null");
+    Preconditions.checkNotNull(partitionSpec, "CatalogPartitionSpec cannot be 
null");
+
+    Table table = loadIcebergTable(tablePath);
+    ensurePartitionedTable(tablePath, table);
+    Optional<PartitionSpec> matchingPartitionSpec = 
getMatchingPartitionSpec(partitionSpec, table.specs());
+    if (!matchingPartitionSpec.isPresent()) {
+      throw new PartitionSpecInvalidException(getName(),
+          table.specs().values().stream()
+              .map(spec -> spec.fields().stream()
+                  .map(PartitionField::name)
+                  .collect(Collectors.joining(",", "{", "}")))
+              .collect(Collectors.toList()),

Review comment:
       This seems was trying to encode all the iceberg partition spec into a 
`List<String>` to `partitionKeys` ?  I don't think it's correct because the 
`PartitionSpecInvalidException`'s `partitionKeys` are partition key names that 
parsed from a specific partition spec, it's usually the latest iceberg 
partition specification spec, right ? 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to