Search in sources :

Example 31 with DataSource

use of org.apache.druid.query.DataSource in project druid by druid-io.

the class DruidQueryTest method test_filtration_noJoinAndInterval.

@Test
public void test_filtration_noJoinAndInterval() {
    DataSource dataSource = new TableDataSource("test");
    Pair<DataSource, Filtration> pair = DruidQuery.getFiltration(dataSource, selectorFilter, VirtualColumnRegistry.create(RowSignature.empty(), TestExprMacroTable.INSTANCE));
    verify(pair, dataSource, selectorFilter, Intervals.ETERNITY);
}
Also used : Filtration(org.apache.druid.sql.calcite.filtration.Filtration) TableDataSource(org.apache.druid.query.TableDataSource) DataSource(org.apache.druid.query.DataSource) TableDataSource(org.apache.druid.query.TableDataSource) JoinDataSource(org.apache.druid.query.JoinDataSource) Test(org.junit.Test)

Example 32 with DataSource

use of org.apache.druid.query.DataSource in project druid by druid-io.

the class DruidQueryTest method test_filtration_joinDataSource_intervalInBaseTableFilter_right.

@Test
public void test_filtration_joinDataSource_intervalInBaseTableFilter_right() {
    DataSource dataSource = join(JoinType.RIGHT, filterWithInterval);
    DataSource expectedDataSource = join(JoinType.RIGHT, selectorFilter);
    Pair<DataSource, Filtration> pair = DruidQuery.getFiltration(dataSource, otherFilter, VirtualColumnRegistry.create(RowSignature.empty(), TestExprMacroTable.INSTANCE));
    verify(pair, expectedDataSource, otherFilter, Intervals.utc(100, 200));
}
Also used : Filtration(org.apache.druid.sql.calcite.filtration.Filtration) DataSource(org.apache.druid.query.DataSource) TableDataSource(org.apache.druid.query.TableDataSource) JoinDataSource(org.apache.druid.query.JoinDataSource) Test(org.junit.Test)

Example 33 with DataSource

use of org.apache.druid.query.DataSource in project druid by druid-io.

the class DruidQueryTest method test_filtration_joinDataSource_intervalInQueryFilter.

@Test
public void test_filtration_joinDataSource_intervalInQueryFilter() {
    DataSource dataSource = join(JoinType.INNER, otherFilter);
    Pair<DataSource, Filtration> pair = DruidQuery.getFiltration(dataSource, filterWithInterval, VirtualColumnRegistry.create(RowSignature.empty(), TestExprMacroTable.INSTANCE));
    verify(pair, dataSource, selectorFilter, Intervals.utc(100, 200));
}
Also used : Filtration(org.apache.druid.sql.calcite.filtration.Filtration) DataSource(org.apache.druid.query.DataSource) TableDataSource(org.apache.druid.query.TableDataSource) JoinDataSource(org.apache.druid.query.JoinDataSource) Test(org.junit.Test)

Example 34 with DataSource

use of org.apache.druid.query.DataSource in project druid by druid-io.

the class DruidSchemaTestCommon method setUpCommon.

@Before
public void setUpCommon() {
    segmentDataSourceNames = Sets.newConcurrentHashSet();
    joinableDataSourceNames = Sets.newConcurrentHashSet();
    segmentManager = new SegmentManager(EasyMock.createMock(SegmentLoader.class)) {

        @Override
        public Set<String> getDataSourceNames() {
            getDatasourcesLatch.countDown();
            return segmentDataSourceNames;
        }
    };
    globalTableJoinable = new JoinableFactory() {

        @Override
        public boolean isDirectlyJoinable(DataSource dataSource) {
            return dataSource instanceof GlobalTableDataSource && joinableDataSourceNames.contains(((GlobalTableDataSource) dataSource).getName());
        }

        @Override
        public Optional<Joinable> build(DataSource dataSource, JoinConditionAnalysis condition) {
            return Optional.empty();
        }
    };
}
Also used : Set(java.util.Set) SegmentManager(org.apache.druid.server.SegmentManager) Optional(java.util.Optional) GlobalTableDataSource(org.apache.druid.query.GlobalTableDataSource) JoinConditionAnalysis(org.apache.druid.segment.join.JoinConditionAnalysis) JoinableFactory(org.apache.druid.segment.join.JoinableFactory) GlobalTableDataSource(org.apache.druid.query.GlobalTableDataSource) DataSource(org.apache.druid.query.DataSource) Before(org.junit.Before)

Example 35 with DataSource

use of org.apache.druid.query.DataSource in project druid by druid-io.

the class DruidQueryTest method test_filtration_joinDataSource_intervalInBaseTableFilter_full.

@Test
public void test_filtration_joinDataSource_intervalInBaseTableFilter_full() {
    DataSource dataSource = join(JoinType.FULL, filterWithInterval);
    DataSource expectedDataSource = join(JoinType.FULL, selectorFilter);
    Pair<DataSource, Filtration> pair = DruidQuery.getFiltration(dataSource, otherFilter, VirtualColumnRegistry.create(RowSignature.empty(), TestExprMacroTable.INSTANCE));
    verify(pair, expectedDataSource, otherFilter, Intervals.utc(100, 200));
}
Also used : Filtration(org.apache.druid.sql.calcite.filtration.Filtration) DataSource(org.apache.druid.query.DataSource) TableDataSource(org.apache.druid.query.TableDataSource) JoinDataSource(org.apache.druid.query.JoinDataSource) Test(org.junit.Test)

Aggregations

DataSource (org.apache.druid.query.DataSource)36 TableDataSource (org.apache.druid.query.TableDataSource)23 Test (org.junit.Test)18 JoinDataSource (org.apache.druid.query.JoinDataSource)17 QueryDataSource (org.apache.druid.query.QueryDataSource)16 GlobalTableDataSource (org.apache.druid.query.GlobalTableDataSource)14 Filtration (org.apache.druid.sql.calcite.filtration.Filtration)12 ArrayList (java.util.ArrayList)10 InlineDataSource (org.apache.druid.query.InlineDataSource)7 HashMap (java.util.HashMap)6 Optional (java.util.Optional)6 LookupDataSource (org.apache.druid.query.LookupDataSource)6 UnionDataSource (org.apache.druid.query.UnionDataSource)6 GroupByQuery (org.apache.druid.query.groupby.GroupByQuery)6 List (java.util.List)5 Nullable (javax.annotation.Nullable)5 DimFilter (org.apache.druid.query.filter.DimFilter)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)4 ISE (org.apache.druid.java.util.common.ISE)4