the-other-tim-brown commented on code in PR #1014:
URL: https://github.com/apache/incubator-xtable/pull/1014#discussion_r4655935502
##########
xtable-core/src/main/java/org/apache/xtable/delta/DeltaStatsUtils.java:
##########
@@ -179,6 +180,24 @@ public static FileStats parseColumnStatsFromJson(String
statsJson, List<Internal
}
}
+ /**
+ * Maps each field's path to the path its stats are keyed by. With column
mapping, Delta keys the
+ * stats by physical name, so a path segment is the field's storage name
when one is set. There is
+ * no fallback to the logical name, which can be another column's physical
name after renames.
+ * Parents must come before their children, as in {@link
InternalSchema#getAllFields()}.
+ */
+ private static Map<String, String> getPhysicalPaths(List<InternalField>
fields) {
+ Map<String, String> physicalPaths = new HashMap<>();
+ for (InternalField field : fields) {
+ String name = field.getStorageName() != null ? field.getStorageName() :
field.getName();
+ String parentPath = field.getParentPath();
+ physicalPaths.put(
+ field.getPath(),
+ StringUtils.isEmpty(parentPath) ? name :
physicalPaths.get(parentPath) + "." + name);
Review Comment:
Can we reuse `SchemaUtils.getFullyQualifiedPath` here?
--
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]