imply-cheddar commented on code in PR #13506:
URL: https://github.com/apache/druid/pull/13506#discussion_r1042989583


##########
processing/src/main/java/org/apache/druid/frame/key/ClusterBy.java:
##########
@@ -58,6 +59,21 @@ public ClusterBy(
     if (bucketByCount < 0 || bucketByCount > columns.size()) {
       throw new IAE("Invalid bucketByCount [%d]", bucketByCount);
     }
+
+    // Key must be 100% sortable or 100% nonsortable. If empty, call it 
unsortable.

Review Comment:
   Is an empty key really unsortable?  An empty key would effectively be 
equivalent to a constant value, and all data sets are sorted by a constant 
value.



##########
processing/src/main/java/org/apache/druid/frame/field/StringFieldReader.java:
##########
@@ -87,6 +87,14 @@ public DimensionSelector makeDimensionSelector(
     return new Selector(memory, fieldPointer, extractionFn, false);
   }
 
+  @Override
+  public boolean isNull(Memory memory, long position)
+  {
+    return memory.getByte(position) == StringFieldWriter.NULL_BYTE
+           && memory.getByte(position + 1) == 
StringFieldWriter.VALUE_TERMINATOR
+           && memory.getByte(position + 2) == StringFieldWriter.ROW_TERMINATOR;

Review Comment:
   Maybe either read a 3-byte array and test for equality or, if there's 
padding, you could read an int, mask away a byte and test equals.



##########
processing/src/main/java/org/apache/druid/frame/key/KeyOrder.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.druid.frame.key;
+
+public enum KeyOrder
+{
+  NONE(false),

Review Comment:
   In your description on this PR, I took away that adding NONE here allows you 
to use that to mean HASHED partitioning.
   
   Maybe I'm not understanding the point of this class, but I think I assumed 
it would only be instantiated if someone was effecting an 
ordering/clustering/partitioning of some sort?  I guess, even on the comment, 
what does it mean for the key to be used for non-sorting purposes, if the point 
of creating the object is for sort-type purposes?  The answer left to me is 
"well, then it's used for clustering/partitioning" in which case, I don't know 
of an algorithm other than HASH, so seems like we can just name it how we 
expect it to be used and then ask ourselves what to do when we come up with a 
new usage that doesn't fit the name HASH?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to