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


##########
processing/src/main/java/org/apache/druid/segment/column/ColumnIndexSupplier.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.segment.column;
+
+import javax.annotation.Nullable;
+
+/**
+ * Provides indexes and information about them ({@link 
ColumnIndexCapabilities}) for a column. Indexes which satisfy
+ * the {@link org.apache.druid.query.filter.Filter} used in a {@link 
org.apache.druid.query.Query}, allow the query
+ * engine to construct {@link org.apache.druid.segment.data.Offset} (and
+ * {@link org.apache.druid.segment.vector.VectorOffset}) to build {@link 
org.apache.druid.segment.Cursor}
+ * (and {@link org.apache.druid.segment.vector.VectorCursor}). This allows the 
engine to only scan the rows which match
+ * the filter values, instead of performing a full scan of the column and 
using a
+ * {@link org.apache.druid.query.filter.ValueMatcher}
+ * (or {@link org.apache.druid.query.filter.vector.VectorValueMatcher}) to 
filter the values (or in addition to, in the
+ * case of indexes which {@link ColumnIndexCapabilities#isExact()} is false, 
which must still use a value matcher
+ * when using an index).
+ */
+public interface ColumnIndexSupplier
+{
+  /**
+   * Get the {@link ColumnIndexCapabilities} for the specified type of index. 
If the index does not exist
+   * this method will return null. A null return value from this method 
indicates that an index of the desired type
+   * in unavailable.
+   */
+  @Nullable
+  <T> ColumnIndexCapabilities getIndexCapabilities(Class<T> clazz);
+
+  /**
+   * Get a column 'index' of the specified type. If the index of the desired 
type is not available, this method will
+   * return null. If the value is non-null, the index may be used for the 
eventual construction of an
+   * {@link org.apache.druid.segment.data.Offset} to form the basis of a 
{@link org.apache.druid.segment.Cursor}
+   * (or {@link org.apache.druid.segment.vector.VectorOffset} and {@link 
org.apache.druid.segment.vector.VectorCursor})
+   * which can greatly reduce the total number of rows which need to be 
scanned and processed.
+   */
+  @Nullable
+  <T> T getIndex(Class<T> clazz);

Review Comment:
   oops, I meant to rename this back to `as` after the changes from the first 
round of reviews, it only called it `getIndex` because `as` seemed strange when 
the interface also had `getIndexCapabilities`, so I've renamed this method to 
`as`.
   
   I actually want to work on reclaiming the word 'index' to primarily be used 
for filtering/cursors so that the codebase is more 'friendly', but not in this 
PR.



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