Skip to content

Commit

Permalink
add copy method to SortKey
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenzwu committed Jun 8, 2023
1 parent 69693cd commit 3970b55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/src/main/java/org/apache/iceberg/SortKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ public SortKey(Schema schema, SortOrder sortOrder) {
super(schema, fieldTransform(sortOrder));
}

private SortKey(SortKey toCopy) {
// only need deep copy inside StructTransform
super(toCopy);
}

public SortKey copy() {
return new SortKey(this);
}

private static List<FieldTransform> fieldTransform(SortOrder sortOrder) {
return sortOrder.fields().stream()
.map(sortField -> new FieldTransform(sortField.sourceId(), sortField.transform()))
Expand Down

0 comments on commit 3970b55

Please sign in to comment.