ExpressionEvaluatorImpl implements ExpressionEvaluator { private boolean evaluateInExpression(InExpression inExpression, DataRow dataRow) { if (inExpression == null) { return false; } Set<Object> candidates = inExpression.getCandidates(); Set<String> candidatesAsConstants = candidates.stream() .filter(c -> c != null) .map(c -> (isConstant(c.getClass())) ? c : evaluate(c, dataRow)) .map(String::valueOf) .collect(Collectors.toSet()); if (candidates.isEmpty()) { return false; } Object value = inExpression.getValue(); if (value == null) { return false; } Class<?> valueClass = value.getClass(); if (!isConstant(valueClass)) { return evaluateInExpression(new InExpression(evaluate(value, dataRow), candidates), dataRow); } return candidatesAsConstants.contains(String.valueOf(value)); }  @Override Map<String, Set<String>> getColumnNames(Object expression); @Override T evaluate(Object expression, DataRow dataRow); @Override T evaluateAs(Object expression, DataRow dataRow, Class<T> cls);  }
@Test public void testEvaluateInExpression() { assertThat(bool(2, Stream.of("1", "2", "3").collect(Collectors.toSet()), EMPTY_ROW), is(true)); assertThat(bool(STRING_COLUMN_VALUE, Stream.of("stuff", column(STRING_COLUMN_NAME, TABLE_NAME)).collect(Collectors.toSet()), ROW_WITH_VALUES), is(true)); assertThat(bool("3", Collections.emptySet(), EMPTY_ROW), is(false)); assertThat(bool(null, Collections.emptySet(), EMPTY_ROW), is(false)); }