rdblue commented on a change in pull request #1815:
URL: https://github.com/apache/iceberg/pull/1815#discussion_r529808020



##########
File path: flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java
##########
@@ -619,7 +625,23 @@ public void alterPartitionColumnStatistics(ObjectPath 
tablePath, CatalogPartitio
   @Override
   public List<CatalogPartitionSpec> listPartitions(ObjectPath tablePath)
       throws CatalogException {
-    throw new UnsupportedOperationException();
+    Table table = icebergCatalog.loadTable(toIdentifier(tablePath));
+    CloseableIterable<FileScanTask> tasks = table.newScan().planFiles();
+    List<DataFile> dataFiles = 
Lists.newArrayList(CloseableIterable.transform(tasks, FileScanTask::file));
+
+    Set<CatalogPartitionSpec> set = Sets.newHashSet();
+    for (DataFile dataFile : dataFiles) {
+      Map<String, String> map = new HashMap<>();
+      PartitionData partitionData = (PartitionData) dataFile.partition();
+      Types.StructType structType = partitionData.getPartitionType();
+      for (int i = 0; i < partitionData.size(); i++) {
+        map.put(structType.fields().get(i).name(), 
partitionData.get(i).toString());

Review comment:
       You can get the partition type for each file using `DataFile.specId()` 
and looking up the spec in the table.




----------------------------------------------------------------
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.

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