use of org.apache.druid.query.extraction.MapLookupExtractor in project druid by druid-io.
the class JoinableFactoryWrapperTest method test_convertJoinsToFilters_dontConvertRhsFunctions.
@Test
public void test_convertJoinsToFilters_dontConvertRhsFunctions() {
final JoinableClause clause = new JoinableClause("j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("x == concat(\"j.k\",'')", "j.", ExprMacroTable.nil()));
final Pair<List<Filter>, List<JoinableClause>> conversion = JoinableFactoryWrapper.convertJoinsToFilters(ImmutableList.of(clause), ImmutableSet.of("x"), Integer.MAX_VALUE);
Assert.assertEquals(Pair.of(ImmutableList.of(), ImmutableList.of(clause)), conversion);
}
use of org.apache.druid.query.extraction.MapLookupExtractor in project druid by druid-io.
the class JoinableFactoryWrapperTest method test_convertJoinsToFilters_convertTwoInnerJoins.
@Test
public void test_convertJoinsToFilters_convertTwoInnerJoins() {
final ImmutableList<JoinableClause> clauses = ImmutableList.of(new JoinableClause("j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("x == \"j.k\"", "j.", ExprMacroTable.nil())), new JoinableClause("_j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("x == \"_j.k\"", "_j.", ExprMacroTable.nil())), new JoinableClause("__j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.LEFT, JoinConditionAnalysis.forExpression("x == \"__j.k\"", "__j.", ExprMacroTable.nil())));
final Pair<List<Filter>, List<JoinableClause>> conversion = JoinableFactoryWrapper.convertJoinsToFilters(clauses, ImmutableSet.of("x"), Integer.MAX_VALUE);
Assert.assertEquals(Pair.of(ImmutableList.of(new InDimFilter("x", TEST_LOOKUP_KEYS), new InDimFilter("x", TEST_LOOKUP_KEYS)), ImmutableList.of(clauses.get(2))), conversion);
}
use of org.apache.druid.query.extraction.MapLookupExtractor in project druid by druid-io.
the class JoinableFactoryWrapperTest method test_convertJoinsToFilters_dontConvertTooManyValues.
@Test
public void test_convertJoinsToFilters_dontConvertTooManyValues() {
final JoinableClause clause = new JoinableClause("j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("x == \"j.k\"", "j.", ExprMacroTable.nil()));
final Pair<List<Filter>, List<JoinableClause>> conversion = JoinableFactoryWrapper.convertJoinsToFilters(ImmutableList.of(clause), ImmutableSet.of("x"), 2);
Assert.assertEquals(Pair.of(ImmutableList.of(), ImmutableList.of(clause)), conversion);
}
use of org.apache.druid.query.extraction.MapLookupExtractor in project druid by druid-io.
the class JoinableFactoryWrapperTest method test_convertJoinsToFilters_dontConvertLhsFunctions.
@Test
public void test_convertJoinsToFilters_dontConvertLhsFunctions() {
final JoinableClause clause = new JoinableClause("j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("concat(x,'') == \"j.k\"", "j.", ExprMacroTable.nil()));
final Pair<List<Filter>, List<JoinableClause>> conversion = JoinableFactoryWrapper.convertJoinsToFilters(ImmutableList.of(clause), ImmutableSet.of("x"), Integer.MAX_VALUE);
Assert.assertEquals(Pair.of(ImmutableList.of(), ImmutableList.of(clause)), conversion);
}
use of org.apache.druid.query.extraction.MapLookupExtractor in project druid by druid-io.
the class JoinableFactoryWrapperTest method test_convertJoinsToFilters_dontConvertJoinsDependedOnByLaterJoins.
@Test
public void test_convertJoinsToFilters_dontConvertJoinsDependedOnByLaterJoins() {
final ImmutableList<JoinableClause> clauses = ImmutableList.of(new JoinableClause("j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("x == \"j.k\"", "j.", ExprMacroTable.nil())), new JoinableClause("_j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.INNER, JoinConditionAnalysis.forExpression("\"j.k\" == \"_j.k\"", "_j.", ExprMacroTable.nil())), new JoinableClause("__j.", LookupJoinable.wrap(new MapLookupExtractor(TEST_LOOKUP, false)), JoinType.LEFT, JoinConditionAnalysis.forExpression("x == \"__j.k\"", "__j.", ExprMacroTable.nil())));
final Pair<List<Filter>, List<JoinableClause>> conversion = JoinableFactoryWrapper.convertJoinsToFilters(clauses, ImmutableSet.of("x"), Integer.MAX_VALUE);
Assert.assertEquals(Pair.of(ImmutableList.of(), clauses), conversion);
}
Aggregations