mao-liu commented on code in PR #767:
URL: https://github.com/apache/incubator-xtable/pull/767#discussion_r2671563333


##########
xtable-core/src/main/java/org/apache/xtable/paimon/PaimonDataFileExtractor.java:
##########
@@ -78,10 +93,154 @@ private String toFullPhysicalPath(FileStoreTable table, 
ManifestEntry entry) {
     }
   }
 
-  private List<ColumnStat> toColumnStats(DataFileMeta file) {
-    // TODO: Implement logic to extract column stats from the file meta
-    // https://github.com/apache/incubator-xtable/issues/755
-    return Collections.emptyList();
+  private List<ColumnStat> toColumnStats(DataFileMeta file, InternalSchema 
internalSchema) {
+    List<ColumnStat> columnStats = new ArrayList<>();
+    Map<String, InternalField> fieldMap =
+        internalSchema.getAllFields().stream()
+            .collect(Collectors.toMap(InternalField::getPath, f -> f));
+
+    // stats for all columns are present in valueStats, we can safely ignore 
file.keyStats() - TODO: validate this assumption
+    SimpleStats valueStats = file.valueStats();
+    if (valueStats != null) {
+      //      log.info("Processing valueStats: {}", valueStats.toRow());
+      List<String> colNames = file.valueStatsCols();
+      //      log.info("valueStatsCols: {}", colNames);
+      if (colNames == null || colNames.isEmpty()) {
+        // if column names are not present, we assume all columns in the 
schema are present in the same order as the schema - TODO: validate this 
assumption

Review Comment:
   Hey @the-other-tim-brown , apologies I haven't been very active on this PR 
until this week.
   I have just emailed the Paimon user group about these questions, and hoping 
to hear back soon.
   
   We have been busy test-driving this change, and happy to report it's working 
well thus far!



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

Reply via email to