abhishekagarwal87 commented on code in PR #15752:
URL: https://github.com/apache/druid/pull/15752#discussion_r1469470141
##########
processing/src/main/java/org/apache/druid/math/expr/ExprEval.java:
##########
@@ -666,7 +666,7 @@ public static ExprEval<?>
castForEqualityComparison(ExprEval<?> valueToCompare,
if (valueToCompare.isArray() && !typeToCompareWith.isArray()) {
final Object[] array = valueToCompare.asArray();
// cannot cast array to scalar if array length is greater than 1
Review Comment:
comment needs a change?
##########
processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java:
##########
@@ -1313,4 +1468,187 @@ private void findNext()
};
}
}
+
+ private class NestedArrayValueIndexes implements ValueIndexes
+ {
+ private final ImmutableBitmap nullValueBitmap =
localDictionarySupplier.get().get(0) == 0
+ ? bitmaps.get(0)
+ :
bitmapFactory.makeEmptyImmutableBitmap();
+
+ @Nullable
+ @Override
+ public BitmapColumnIndex forValue(@Nonnull Object value,
TypeSignature<ValueType> valueType)
+ {
+ if (!valueType.isArray()) {
+ return new AllFalseBitmapColumnIndex(bitmapFactory, nullValueBitmap);
+ }
+ final ExprEval<?> eval =
ExprEval.ofType(ExpressionType.fromColumnTypeStrict(valueType), value);
+ final ExprEval<?> castForComparison = ExprEval.castForEqualityComparison(
+ eval,
+ ExpressionType.fromColumnTypeStrict(singleType)
+ );
+ if (castForComparison == null) {
+ return new AllFalseBitmapColumnIndex(bitmapFactory, nullValueBitmap);
+ }
+ final Object[] arrayToMatch = castForComparison.asArray();
+ Indexed elements;
+ final int elementOffset;
+
+ switch (singleType.getElementType().getType()) {
+ case STRING:
+ elements = globalStringDictionarySupplier.get();
+ elementOffset = 0;
+ break;
+ case LONG:
+ elements = globalLongDictionarySupplier.get();
+ elementOffset = adjustLongId;
+ break;
+ case DOUBLE:
+ elements = globalDoubleDictionarySupplier.get();
+ elementOffset = adjustDoubleId;
+ break;
+ default:
+ throw DruidException.defensive(
+ "Unhandled array type [%s] how did this happen?",
Review Comment:
```suggestion
"Unhandled array type [%s]. ",
```
--
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]