Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
clintropolis committed Nov 30, 2023
1 parent ca7ccf4 commit f974fcc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public DimFilter toDruidFilter(
ExprEval<?> exprEval = expr.eval(InputBindings.nilBindings());
if (exprEval.isArray()) {
final Object[] arrayElements = exprEval.asArray();
if (arrayElements.length == 0) {
// this isn't likely possible today because array constructor function does not accept empty argument list
// but just in case, return null
return null;
}
final List<DimFilter> filters = new ArrayList<>(arrayElements.length);
final ColumnType elementType = ExpressionType.toColumnType(ExpressionType.elementType(exprEval.type()));
for (final Object val : arrayElements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ public DimFilter toDruidFilter(
ExprEval<?> exprEval = expr.eval(InputBindings.nilBindings());
if (exprEval.isArray()) {
final Object[] arrayElements = exprEval.asArray();
if (arrayElements.length == 0) {
// this isn't likely possible today because array constructor function does not accept empty argument list
// but just in case, return null
return null;
}
final List<DimFilter> filters = new ArrayList<>(arrayElements.length);
final ColumnType elementType = ExpressionType.toColumnType(ExpressionType.elementType(exprEval.type()));
for (final Object val : arrayElements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,8 @@ public void testGroupByRootSingleTypeArrayLongNullsFilteredMore()
.setDimFilter(
or(
new ArrayContainsElementFilter("arrayLongNulls", ColumnType.LONG, 1L, null),
expressionFilter("array_overlap(\"arrayLongNulls\",array(2,3))")
new ArrayContainsElementFilter("arrayLongNulls", ColumnType.LONG, 2L, null),
new ArrayContainsElementFilter("arrayLongNulls", ColumnType.LONG, 3L, null)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
Expand Down

0 comments on commit f974fcc

Please sign in to comment.