You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/11/26 17:21:07 UTC

[GitHub] [incubator-iceberg] aokolnychyi commented on a change in pull request #589: [WIP] Extend metadata with SortOrder

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

 ##########
 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 agree that sharing transforms between `SortOrder` and `PartitionSpec` is a good idea.
   
   W.r.t the order within/across tasks. Did I get correctly the idea is that query engines should sort data globally/locally depending on whether partition columns are included in the sort order? If yes, I have a couple of questions. For example, we can have multiple pipelines writing to the same table. While it is beneficial to sort data globally in batch jobs, we might want to sort data within tasks or disable sorting at all in streaming jobs. Internally, we allow our customers to configure their sort mode on write via a SQL config. That gives them the needed flexibility to configure the sort mode per job. Since we plan to annotate files with `sort_order_id`, compaction jobs might take that into account as well. Is it reasonable to say the sort mode should be configurable per job rather than per table?
   
   My original understanding was that `SortOrder` should apply only within partitions. Basically, the actual sort key is derived by combining partition and sort values (which should be done by query engines). Also, not including partition columns in the sort key won’t work because we will generate a lot of files per task. Is this reasonable?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org