rdblue commented on a change in pull request #589: [WIP] Extend metadata with SortOrder URL: https://github.com/apache/incubator-iceberg/pull/589#discussion_r344515798
########## File path: api/src/main/java/org/apache/iceberg/SortField.java ########## @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iceberg; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Objects; +import org.apache.iceberg.SortTransforms.SortTransform; + +public class SortField implements Serializable { + public enum Direction { + ASC, DESC + } + + public enum NullOrder { + NULLS_FIRST, NULLS_LAST + } + + private final String name; + private final Direction direction; + private final NullOrder nullOrder; + private final SortTransform transform; Review comment: I think it is likely that sort transforms and partition transforms mostly overlap, so we may consider using the same `Transform` class for both. When configuring a table's sort order, I think we want to allow both an order across tasks as well as a local order in a single task. Then, the table can be configured with an ordering that includes partition columns so that Iceberg can tell the processing engine to use an ordering for a write that includes partitions. A concrete use case is that we have a table partitioned by `date(ts)` and `bucket(id, 16)`, and we want Spark to write using `date(ts)`, `bucket(id, 16)`, and finally, `id`. If we want partitions in the sort order, then we will need to support all of those transforms and probably want to standardize on `Transform`. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
