Source:
<code>public DimFilter toDruidFilter( final PlannerContext plannerContext, RowSignature rowSignature, @Nullable VirtualColumnRegistry virtualColumnRegistry, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final List<DruidExpression> druidExpressions = Expressions.toDruidExpressions( plannerContext, rowSignature, operands ); if (druidExpressions == null) { return null; } final boolean leftSimpleExtractionExpr = druidExpressions.get(0).isSimpleExtraction(); final boolean rightSimpleExtractionExpr = druidExpressions.get(1).isSimpleExtraction(); final DruidExpression simpleExtractionExpr; final DruidExpression complexExpr; if (leftSimpleExtractionExpr ^ rightSimpleExtractionExpr) { if (leftSimpleExtractionExpr) { simpleExtractionExpr = druidExpressions.get(0); complexExpr = druidExpressions.get(1); } else { simpleExtractionExpr = druidExpressions.get(1); complexExpr = druidExpressions.get(0); } } else { return toExpressionFilter(plannerContext, getDruidFunctionName(), druidExpressions); } Expr expr = Parser.parse(complexExpr.getExpression(), plannerContext.getExprMacroTable()); <START> if (expr.isLiteral()) { <END> ExprEval<?> exprEval = expr.eval(null); String[] arrayElements = exprEval.asStringArray(); if (arrayElements == null || arrayElements.length == 0) { return null; } else if (arrayElements.length == 1) { return newSelectorDimFilter(simpleExtractionExpr.getSimpleExtraction(), arrayElements[0]); } else { return new InDimFilter( simpleExtractionExpr.getSimpleExtraction().getColumn(), Sets.newHashSet(arrayElements), simpleExtractionExpr.getSimpleExtraction().getExtractionFn() ); } } return toExpressionFilter(plannerContext, getDruidFunctionName(), druidExpressions); }</code><technical_language>nit: is worth splitting this out a static method of classes (or a utility method somewhere) this block basically shared array_contains</technical_language>

Target:
public DimFilter toDruidFilter( final PlannerContext plannerContext, RowSignature rowSignature, @Nullable VirtualColumnRegistry virtualColumnRegistry, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final List<DruidExpression> druidExpressions = Expressions.toDruidExpressions( plannerContext, rowSignature, operands ); if (druidExpressions == null) { return null; } final boolean leftSimpleExtractionExpr = druidExpressions.get(0).isSimpleExtraction(); final boolean rightSimpleExtractionExpr = druidExpressions.get(1).isSimpleExtraction(); final DruidExpression simpleExtractionExpr; final DruidExpression complexExpr; if (leftSimpleExtractionExpr ^ rightSimpleExtractionExpr) { if (leftSimpleExtractionExpr) { simpleExtractionExpr = druidExpressions.get(0); complexExpr = druidExpressions.get(1); } else { simpleExtractionExpr = druidExpressions.get(1); complexExpr = druidExpressions.get(0); } } else { return toExpressionFilter(plannerContext, getDruidFunctionName(), druidExpressions); } Expr expr = Parser.parse(complexExpr.getExpression(), plannerContext.getExprMacroTable()); if (expr.isLiteral()) { ExprEval<?> exprEval = expr.eval(name -> null); String[] arrayElements = exprEval.asStringArray(); if (arrayElements == null || arrayElements.length == 0) { return null; } else if (arrayElements.length == 1) { return newSelectorDimFilter(simpleExtractionExpr.getSimpleExtraction(), arrayElements[0]); } else { return new InDimFilter( simpleExtractionExpr.getSimpleExtraction().getColumn(), Sets.newHashSet(arrayElements), simpleExtractionExpr.getSimpleExtraction().getExtractionFn() ); } } return toExpressionFilter(plannerContext, getDruidFunctionName(), druidExpressions); }