Skip to content

Commit

Permalink
Core: Use UnboundSortOrder, UnboundPartitionSpec in CreateTableRequest (
Browse files Browse the repository at this point in the history
  • Loading branch information
kbendick authored May 27, 2022
1 parent b02dbbc commit ed24d93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/org/apache/iceberg/SortOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private List<SortField> lazyFieldList() {
return fieldList;
}

UnboundSortOrder toUnbound() {
public UnboundSortOrder toUnbound() {
UnboundSortOrder.Builder builder = UnboundSortOrder.builder().withOrderId(orderId);

for (SortField field : fields) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
import org.apache.iceberg.SortOrder;
import org.apache.iceberg.UnboundPartitionSpec;
import org.apache.iceberg.UnboundSortOrder;
import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
Expand All @@ -38,8 +40,8 @@ public class CreateTableRequest implements RESTRequest {
private String name;
private String location;
private Schema schema;
private PartitionSpec spec;
private SortOrder order;
private UnboundPartitionSpec spec;
private UnboundSortOrder order;
private Map<String, String> properties;
private Boolean stageCreate;

Expand All @@ -52,8 +54,8 @@ private CreateTableRequest(String name, String location, Schema schema, Partitio
this.name = name;
this.location = location;
this.schema = schema;
this.spec = spec;
this.order = order;
this.spec = spec != null ? spec.toUnbound() : null;
this.order = order != null ? order.toUnbound() : null;
this.properties = properties;
this.stageCreate = stageCreate;
validate();
Expand All @@ -79,11 +81,11 @@ public Schema schema() {
}

public PartitionSpec spec() {
return spec;
return spec != null ? spec.bind(schema) : null;
}

public SortOrder writeOrder() {
return order;
return order != null ? order.bind(schema) : null;
}

public Map<String, String> properties() {
Expand Down

0 comments on commit ed24d93

Please sign in to comment.