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



##########
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:
       Yes, `partitionKeys` should be a list of partition key names. The 
current implementation is a list of all partition spec keys. For example, a 
table with two specs may display something like [{key1, key2}, {key1, key2, 
key3}]. Should we merge partition key names from all partition specs as 
`partitionKeys`, like [key1, key2, key3]? Because this exception is thrown 
after looking for all partition specs but still not found a matching spec. Or 
should we use other exception for this situation? But I do not see any suitable 
exception class in `org.apache.flink.table.catalog.exceptions`.




-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to