geruh commented on code in PR #9818: URL: https://github.com/apache/iceberg/pull/9818#discussion_r2060981381
########## spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/SparkZOrderDataRewriter.java: ########## @@ -135,15 +140,52 @@ private Column zValue(Dataset<Row> df) { SparkZOrderUDF zOrderUDF = new SparkZOrderUDF(zOrderColNames.size(), varLengthContribution, maxOutputSize); + Map<String, List<StructField>> fieldChainMap = Maps.newHashMap(); + collectFieldChains(df.schema(), Lists.newArrayList(), fieldChainMap); + Column[] zOrderCols = zOrderColNames.stream() - .map(df.schema()::apply) - .map(col -> zOrderUDF.sortedLexicographically(df.col(col.name()), col.dataType())) + .map(colName -> getColumn(colName, df, zOrderUDF, fieldChainMap)) .toArray(Column[]::new); return zOrderUDF.interleaveBytes(array(zOrderCols)); } + private Column getColumn( + String zOrderColName, + Dataset<Row> df, + SparkZOrderUDF zOrderUDF, + Map<String, List<StructField>> fieldChainMap) { + List<StructField> fieldChain = fieldChainMap.getOrDefault(zOrderColName, Lists.newArrayList()); + String colName = Review Comment: nit: use the collectors.join to avoid mapping to list, and then joining ```fieldChain.stream() .map(f -> String.format("`%s`", f.name())).collect(Collectors.joining("."))``` -- 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