rdblue commented on a change in pull request #589: [WIP] Extend metadata with 
SortOrder
URL: https://github.com/apache/incubator-iceberg/pull/589#discussion_r344515484
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/SortOrder.java
 ##########
 @@ -0,0 +1,165 @@
+/*
+ * 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 com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import org.apache.iceberg.SortField.Direction;
+import org.apache.iceberg.SortField.NullOrder;
+import org.apache.iceberg.SortTransforms.SortTransform;
+import org.apache.iceberg.types.Types;
+
+// TODO: toString()
+public class SortOrder implements Serializable {
+
+  private static final SortOrder UNSORTED_ORDER = new SortOrder(new Schema(), 
0, ImmutableList.of());
+
+  private final Schema schema;
+  private final int orderId;
+  private final SortField[] fields;
+  private transient volatile List<SortField> fieldList;
+
+  public static SortOrder unsorted() {
+    return UNSORTED_ORDER;
+  }
+
+  private SortOrder(Schema schema, int orderId, List<SortField> fields) {
+    this.schema = schema;
+    this.orderId = orderId;
+    this.fields = new SortField[fields.size()];
+    for (int fieldIndex = 0; fieldIndex < this.fields.length; fieldIndex++) {
 
 Review comment:
   Nit: could use `fields.toArray(new SortField[0])` instead.

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

Reply via email to