use of org.apache.druid.query.TableDataSource in project druid by druid-io.
the class CalciteQueryTest method testGroupingWithNullInFilter.
@Test
public void testGroupingWithNullInFilter() throws Exception {
// HashJoinSegmentStorageAdapter is not vectorizable
cannotVectorize();
testQuery("SELECT COUNT(*) FROM foo WHERE dim1 IN (NULL)", ImmutableList.of(Druids.newTimeseriesQueryBuilder().dataSource(JoinDataSource.create(new TableDataSource(CalciteTests.DATASOURCE1), InlineDataSource.fromIterable(ImmutableList.of(new Object[] { null }), RowSignature.builder().add("ROW_VALUE", ColumnType.STRING).build()), "j0.", "(\"dim1\" == \"j0.ROW_VALUE\")", JoinType.INNER, null, ExprMacroTable.nil())).intervals(querySegmentSpec(Filtration.eternity())).granularity(Granularities.ALL).aggregators(aggregators(new CountAggregatorFactory("a0"))).context(QUERY_CONTEXT_DEFAULT).build()), ImmutableList.of(new Object[] { 0L }));
}
use of org.apache.druid.query.TableDataSource in project druid by druid-io.
the class LookupSegmentWranglerTest method test_getSegmentsForIntervals_nonLookup.
@Test
public void test_getSegmentsForIntervals_nonLookup() {
expectedException.expect(ClassCastException.class);
expectedException.expectMessage("TableDataSource cannot be cast");
final Iterable<Segment> ignored = factory.getSegmentsForIntervals(new TableDataSource("foo"), Intervals.ONLY_ETERNITY);
}
use of org.apache.druid.query.TableDataSource in project druid by druid-io.
the class InlineJoinableFactoryTest method testBuildNonInline.
@Test
public void testBuildNonInline() {
expectedException.expect(ClassCastException.class);
expectedException.expectMessage("TableDataSource cannot be cast");
final Optional<Joinable> ignored = factory.build(new TableDataSource("foo"), makeCondition("x == \"j.y\""));
}
use of org.apache.druid.query.TableDataSource in project druid by druid-io.
the class LookupJoinableFactoryTest method testBuildNonLookup.
@Test
public void testBuildNonLookup() {
expectedException.expect(ClassCastException.class);
expectedException.expectMessage("TableDataSource cannot be cast");
final Optional<Joinable> ignored = factory.build(new TableDataSource("foo"), makeCondition("x == \"j.k\""));
}
use of org.apache.druid.query.TableDataSource in project druid by druid-io.
the class CalciteJoinQueryTest method testUnionAllTwoQueriesBothQueriesAreJoin.
@Test
public void testUnionAllTwoQueriesBothQueriesAreJoin() throws Exception {
cannotVectorize();
testQuery("(" + "SELECT COUNT(*) FROM foo LEFT JOIN lookup.lookyloo ON foo.dim1 = lookyloo.k " + " UNION ALL " + "SELECT COUNT(*) FROM foo INNER JOIN lookup.lookyloo ON foo.dim1 = lookyloo.k" + ") ", ImmutableList.of(Druids.newTimeseriesQueryBuilder().dataSource(join(new TableDataSource(CalciteTests.DATASOURCE1), new LookupDataSource("lookyloo"), "j0.", equalsCondition(makeColumnExpression("dim1"), makeColumnExpression("j0.k")), JoinType.LEFT)).intervals(querySegmentSpec(Filtration.eternity())).granularity(Granularities.ALL).aggregators(aggregators(new CountAggregatorFactory("a0"))).context(QUERY_CONTEXT_DEFAULT).build(), Druids.newTimeseriesQueryBuilder().dataSource(join(new TableDataSource(CalciteTests.DATASOURCE1), new LookupDataSource("lookyloo"), "j0.", equalsCondition(makeColumnExpression("dim1"), makeColumnExpression("j0.k")), JoinType.INNER)).intervals(querySegmentSpec(Filtration.eternity())).granularity(Granularities.ALL).aggregators(aggregators(new CountAggregatorFactory("a0"))).context(QUERY_CONTEXT_DEFAULT).build()), ImmutableList.of(new Object[] { 6L }, new Object[] { 1L }));
}
Aggregations