This is an automated email from the ASF dual-hosted git repository.
cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 24c345cdf0 Allow dictionary encoded column to use a more generic index
interface (#12826)
24c345cdf0 is described below
commit 24c345cdf02648414c9d7d15e09017bc02748ec4
Author: Maytas Monsereenusorn <[email protected]>
AuthorDate: Wed Jul 27 15:23:00 2022 -0700
Allow dictionary encoded column to use a more generic index interface
(#12826)
---
.../segment/QueryableIndexIndexableAdapter.java | 4 +--
.../column/DictionaryEncodedStringValueIndex.java | 9 +------
...Index.java => DictionaryEncodedValueIndex.java} | 29 +++-------------------
.../DictionaryEncodedStringIndexSupplier.java | 3 ++-
.../segment/virtual/ListFilteredVirtualColumn.java | 3 ++-
5 files changed, 10 insertions(+), 38 deletions(-)
diff --git
a/processing/src/main/java/org/apache/druid/segment/QueryableIndexIndexableAdapter.java
b/processing/src/main/java/org/apache/druid/segment/QueryableIndexIndexableAdapter.java
index 4b6eb38f03..bb3fb1b5e5 100644
---
a/processing/src/main/java/org/apache/druid/segment/QueryableIndexIndexableAdapter.java
+++
b/processing/src/main/java/org/apache/druid/segment/QueryableIndexIndexableAdapter.java
@@ -30,7 +30,7 @@ import org.apache.druid.segment.column.ColumnHolder;
import org.apache.druid.segment.column.ColumnIndexSupplier;
import org.apache.druid.segment.column.ComplexColumn;
import org.apache.druid.segment.column.DictionaryEncodedColumn;
-import org.apache.druid.segment.column.DictionaryEncodedStringValueIndex;
+import org.apache.druid.segment.column.DictionaryEncodedValueIndex;
import org.apache.druid.segment.data.BitmapValues;
import org.apache.druid.segment.data.CloseableIndexed;
import org.apache.druid.segment.data.ImmutableBitmapValues;
@@ -379,7 +379,7 @@ public class QueryableIndexIndexableAdapter implements
IndexableAdapter
if (indexSupplier == null) {
return BitmapValues.EMPTY;
}
- final DictionaryEncodedStringValueIndex bitmaps =
indexSupplier.as(DictionaryEncodedStringValueIndex.class);
+ final DictionaryEncodedValueIndex bitmaps =
indexSupplier.as(DictionaryEncodedValueIndex.class);
if (bitmaps == null) {
return BitmapValues.EMPTY;
}
diff --git
a/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
b/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
index 9bede2a4da..f8df78ca09 100644
---
a/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
+++
b/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
@@ -19,8 +19,6 @@
package org.apache.druid.segment.column;
-import org.apache.druid.collections.bitmap.ImmutableBitmap;
-
import javax.annotation.Nullable;
/**
@@ -32,7 +30,7 @@ import javax.annotation.Nullable;
* should likely be using {@link StringValueSetIndex}, {@link
DruidPredicateIndex}, {@link LexicographicalRangeIndex} or
* some other higher level index instead.
*/
-public interface DictionaryEncodedStringValueIndex
+public interface DictionaryEncodedStringValueIndex extends
DictionaryEncodedValueIndex
{
boolean hasNulls();
/**
@@ -51,9 +49,4 @@ public interface DictionaryEncodedStringValueIndex
* the underlying dictionary
*/
int getIndex(@Nullable String value);
-
- /**
- * Get the {@link ImmutableBitmap} for dictionary id of the underlying
dictionary
- */
- ImmutableBitmap getBitmap(int idx);
}
diff --git
a/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
b/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedValueIndex.java
similarity index 55%
copy from
processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
copy to
processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedValueIndex.java
index 9bede2a4da..c088f7455b 100644
---
a/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedStringValueIndex.java
+++
b/processing/src/main/java/org/apache/druid/segment/column/DictionaryEncodedValueIndex.java
@@ -21,37 +21,14 @@ package org.apache.druid.segment.column;
import org.apache.druid.collections.bitmap.ImmutableBitmap;
-import javax.annotation.Nullable;
-
/**
- * This exposes a 'raw' view into a bitmap value indexes of a string {@link
DictionaryEncodedColumn}, allowing
- * operation via dictionaryIds, as well as access to lower level details of
such a column like value lookup and
- * value cardinality.
+ * This exposes a 'raw' view into a bitmap value indexes, allowing operation
via dictionaryIds
*
* This interface should only be used when it is beneficial to operate in such
a manner, most filter implementations
- * should likely be using {@link StringValueSetIndex}, {@link
DruidPredicateIndex}, {@link LexicographicalRangeIndex} or
- * some other higher level index instead.
+ * should likely be using higher level index instead.
*/
-public interface DictionaryEncodedStringValueIndex
+public interface DictionaryEncodedValueIndex
{
- boolean hasNulls();
- /**
- * Get the cardinality of the underlying value dictionary
- */
- int getCardinality();
-
- /**
- * Get the value in the underlying value dictionary of the specified
dictionary id
- */
- @Nullable
- String getValue(int index);
-
- /**
- * Returns the index of "value" in this DictionaryEncodedStringValueIndex,
or a negative value, if not present in
- * the underlying dictionary
- */
- int getIndex(@Nullable String value);
-
/**
* Get the {@link ImmutableBitmap} for dictionary id of the underlying
dictionary
*/
diff --git
a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplier.java
b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplier.java
index 30b31784b1..85831d268a 100644
---
a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplier.java
+++
b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplier.java
@@ -35,6 +35,7 @@ import org.apache.druid.segment.IntListUtils;
import org.apache.druid.segment.column.BitmapColumnIndex;
import org.apache.druid.segment.column.ColumnIndexSupplier;
import org.apache.druid.segment.column.DictionaryEncodedStringValueIndex;
+import org.apache.druid.segment.column.DictionaryEncodedValueIndex;
import org.apache.druid.segment.column.DruidPredicateIndex;
import org.apache.druid.segment.column.LexicographicalRangeIndex;
import org.apache.druid.segment.column.NullValueIndex;
@@ -105,7 +106,7 @@ public class DictionaryEncodedStringIndexSupplier
implements ColumnIndexSupplier
bitmaps,
NullHandling.isNullOrEquivalent(dictionary.get(0))
);
- } else if (clazz.equals(DictionaryEncodedStringValueIndex.class)) {
+ } else if (clazz.equals(DictionaryEncodedStringValueIndex.class) ||
clazz.equals(DictionaryEncodedValueIndex.class)) {
return (T) new
GenericIndexedDictionaryEncodedStringValueIndex(bitmapFactory, dictionary,
bitmaps);
}
}
diff --git
a/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java
b/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java
index 14b6f173c0..e273ab2bcd 100644
---
a/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java
+++
b/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java
@@ -46,6 +46,7 @@ import org.apache.druid.segment.column.ColumnCapabilitiesImpl;
import org.apache.druid.segment.column.ColumnHolder;
import org.apache.druid.segment.column.ColumnIndexSupplier;
import org.apache.druid.segment.column.DictionaryEncodedStringValueIndex;
+import org.apache.druid.segment.column.DictionaryEncodedValueIndex;
import org.apache.druid.segment.column.DruidPredicateIndex;
import org.apache.druid.segment.column.LexicographicalRangeIndex;
import org.apache.druid.segment.column.NullValueIndex;
@@ -229,7 +230,7 @@ public class ListFilteredVirtualColumn implements
VirtualColumn
return (T) new ListFilteredDruidPredicateIndex(underlyingIndex,
idMapping);
} else if (clazz.equals(LexicographicalRangeIndex.class)) {
return (T) new
ListFilteredLexicographicalRangeIndex(underlyingIndex, idMapping);
- } else if (clazz.equals(DictionaryEncodedStringValueIndex.class)) {
+ } else if (clazz.equals(DictionaryEncodedStringValueIndex.class) ||
clazz.equals(DictionaryEncodedValueIndex.class)) {
return (T) new
ListFilteredDictionaryEncodedStringValueIndex(underlyingIndex, idMapping);
}
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]