clintropolis commented on code in PR #13694:
URL: https://github.com/apache/druid/pull/13694#discussion_r1084682271


##########
processing/src/main/java/org/apache/druid/query/rowsandcols/column/DoubleArrayColumn.java:
##########
@@ -126,4 +74,122 @@ public <T> T as(Class<? extends T> clazz)
     }
     return null;
   }
+
+  private class MyColumnAccessor implements BinarySearchableAccessor

Review Comment:
   should this only be a binary searchable accessor if the column is sorted?



##########
processing/src/main/java/org/apache/druid/query/rowsandcols/util/FindResult.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.query.rowsandcols.util;
+
+public class FindResult

Review Comment:
   i know this makes stuff nicer, but wondering is this maybe expensive if we 
need to find a lot of things compared to just dealing in `int`?
   
   Just thinking out loud, probably don't need to worry about it right now



##########
processing/src/main/java/org/apache/druid/query/rowsandcols/column/BinarySearchableAccessor.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.query.rowsandcols.column;
+
+import org.apache.druid.java.util.common.ISE;
+import org.apache.druid.query.rowsandcols.util.FindResult;
+
+public interface BinarySearchableAccessor extends ColumnAccessor
+{
+  static BinarySearchableAccessor fromColumn(Column col)
+  {
+    final BinarySearchableAccessor retVal = 
col.as(BinarySearchableAccessor.class);
+
+    if (retVal == null) {
+      final ColumnAccessor accessor = col.toAccessor();
+      if (accessor instanceof BinarySearchableAccessor) {
+        // Why didn't they just return it from the as()!?!?!  Who knows, ah 
well.
+        return (BinarySearchableAccessor) accessor;
+      }
+
+      throw new ISE("col[%s] is a no-go", col.getClass());
+    }
+    return retVal;
+  }
+
+  FindResult findNull(int startIndex, int endIndex);
+
+  FindResult findDouble(int startIndex, int endIndex, double val);
+
+  FindResult findFloat(int startIndex, int endIndex, float val);
+
+  FindResult findLong(int startIndex, int endIndex, long val);
+
+  FindResult findString(int startIndex, int endIndex, String val);
+
+  FindResult findComplex(int startIndex, int endIndex, Object val);

Review Comment:
   should this be findObject instead of findComplex, that is if it should also 
handle other object types such as ARRAY<LONG>, ARRAY<STRING>, ARRAY<ARRAY<...>> 
etc? Or do you imagine array types will have some other method?



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