aokolnychyi commented on a change in pull request #2240:
URL: https://github.com/apache/iceberg/pull/2240#discussion_r691628415



##########
File path: core/src/main/java/org/apache/iceberg/util/SortOrderUtil.java
##########
@@ -64,4 +68,16 @@ static SortOrder buildSortOrder(Schema schema, PartitionSpec 
spec, SortOrder sor
 
     return builder.build();
   }
+
+  public static Set<String> sortedColumns(SortOrder sortOrder) {
+    if (sortOrder == null) {
+      return Collections.emptySet();
+    } else {
+      return sortOrder.fields().stream()
+          .map(SortField::sourceId)
+          .map(sid -> sortOrder.schema().findColumnName(sid))

Review comment:
       After another look with fresh eyes, I don't think my statement above is 
accurate. If we sort using an order preserving transform, it means the source 
columns are somehow sorted (but may not be perfectly sorted).
   
   For example, sorting by `month(date)`, means our dates are sorted across 
months but not necessarily within each month. Still, it probably makes sense to 
promote such columns. Identity and truncate transforms are also order 
preserving.
   
   @RussellSpitzer @jackye1995, thoughts?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to