Search in sources :

Example 26 with JoinFilterPreAnalysis

use of org.apache.druid.segment.join.filter.JoinFilterPreAnalysis in project druid by druid-io.

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryRightWithFilterOnLeftIsNullUsingLookup.

@Test
public void test_makeCursors_factToCountryRightWithFilterOnLeftIsNullUsingLookup() {
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryNameUsingIsoCodeLookup(JoinType.RIGHT));
    Filter filter = new SelectorDimFilter("channel", null, null).toFilter();
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(filter, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(filter, Intervals.ETERNITY, VirtualColumns.EMPTY, Granularities.ALL, false, null), ImmutableList.of("page", "countryIsoCode", "countryNumber", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "k", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "v"), ImmutableList.of(new Object[] { null, null, NullHandling.sqlCompatible() ? null : 0L, "AX", "Atlantis" }, new Object[] { null, null, NullHandling.sqlCompatible() ? null : 0L, "USCA", "Usca" }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) ExpressionDimFilter(org.apache.druid.query.filter.ExpressionDimFilter) Filter(org.apache.druid.query.filter.Filter) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 27 with JoinFilterPreAnalysis

use of org.apache.druid.segment.join.filter.JoinFilterPreAnalysis in project druid by druid-io.

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryInnerWithBaseFilter.

@Test
public void test_makeCursors_factToCountryInnerWithBaseFilter() {
    final Filter baseFilter = Filters.or(Arrays.asList(new SelectorDimFilter("countryIsoCode", "CA", null).toFilter(), new SelectorDimFilter("countryIsoCode", "MatchNothing", null).toFilter()));
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryOnIsoCode(JoinType.INNER));
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(baseFilter, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), baseFilter, joinableClauses, joinFilterPreAnalysis).makeCursors(null, Intervals.ETERNITY, VirtualColumns.EMPTY, Granularities.ALL, false, null), ImmutableList.of("page", "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryNumber"), ImmutableList.of(new Object[] { "Didier Leclair", "CA", "CA", "Canada", 1L }, new Object[] { "Les Argonautes", "CA", "CA", "Canada", 1L }, new Object[] { "Sarah Michelle Gellar", "CA", "CA", "Canada", 1L }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) ExpressionDimFilter(org.apache.druid.query.filter.ExpressionDimFilter) Filter(org.apache.druid.query.filter.Filter) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 28 with JoinFilterPreAnalysis

use of org.apache.druid.segment.join.filter.JoinFilterPreAnalysis in project druid by druid-io.

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_originalFilterDoesNotMatchPreAnalysis_shouldThrowISE.

@Test
public void test_makeCursors_originalFilterDoesNotMatchPreAnalysis_shouldThrowISE() {
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryOnIsoCode(JoinType.LEFT));
    Filter filter = new SelectorFilter("page", "this matches nothing");
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(filter, joinableClauses, VirtualColumns.EMPTY);
    new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(filter, Intervals.ETERNITY, VirtualColumns.EMPTY, Granularities.ALL, false, null);
}
Also used : SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) ExpressionDimFilter(org.apache.druid.query.filter.ExpressionDimFilter) Filter(org.apache.druid.query.filter.Filter) Test(org.junit.Test)

Example 29 with JoinFilterPreAnalysis

use of org.apache.druid.segment.join.filter.JoinFilterPreAnalysis in project druid by druid-io.

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryRightWithBaseFilter.

@Test
public void test_makeCursors_factToCountryRightWithBaseFilter() {
    final Filter baseFilter = Filters.or(Arrays.asList(new SelectorDimFilter("countryIsoCode", "CA", null).toFilter(), new SelectorDimFilter("countryIsoCode", "MatchNothing", null).toFilter()));
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryOnIsoCode(JoinType.RIGHT));
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(baseFilter, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), baseFilter, joinableClauses, joinFilterPreAnalysis).makeCursors(null, Intervals.ETERNITY, VirtualColumns.EMPTY, Granularities.ALL, false, null), ImmutableList.of("page", "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryNumber"), ImmutableList.of(new Object[] { "Didier Leclair", "CA", "CA", "Canada", 1L }, new Object[] { "Les Argonautes", "CA", "CA", "Canada", 1L }, new Object[] { "Sarah Michelle Gellar", "CA", "CA", "Canada", 1L }, new Object[] { null, null, "AU", "Australia", 0L }, new Object[] { null, null, "CL", "Chile", 2L }, new Object[] { null, null, "DE", "Germany", 3L }, new Object[] { null, null, "EC", "Ecuador", 4L }, new Object[] { null, null, "FR", "France", 5L }, new Object[] { null, null, "GB", "United Kingdom", 6L }, new Object[] { null, null, "IT", "Italy", 7L }, new Object[] { null, null, "JP", "Japan", 8L }, new Object[] { null, null, "KR", "Republic of Korea", 9L }, new Object[] { null, null, "MX", "Mexico", 10L }, new Object[] { null, null, "NO", "Norway", 11L }, new Object[] { null, null, "SV", "El Salvador", 12L }, new Object[] { null, null, "US", "United States", 13L }, new Object[] { null, null, "AX", "Atlantis", 14L }, new Object[] { null, null, "SU", "States United", 15L }, new Object[] { null, null, "USCA", "Usca", 16L }, new Object[] { null, null, "MMMM", "Fourems", 205L }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) ExpressionDimFilter(org.apache.druid.query.filter.ExpressionDimFilter) Filter(org.apache.druid.query.filter.Filter) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 30 with JoinFilterPreAnalysis

use of org.apache.druid.segment.join.filter.JoinFilterPreAnalysis in project druid by druid-io.

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryLeftWithFilterOnJoinableUsingLookup.

@Test
public void test_makeCursors_factToCountryLeftWithFilterOnJoinableUsingLookup() {
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryNameUsingIsoCodeLookup(JoinType.LEFT));
    Filter filter = new OrDimFilter(new SelectorDimFilter(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "k", "DE", null), new SelectorDimFilter(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "v", "Norway", null)).toFilter();
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(filter, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(filter, Intervals.ETERNITY, VirtualColumns.EMPTY, Granularities.ALL, false, null), ImmutableList.of("page", "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "k", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "v"), ImmutableList.of(new Object[] { "Diskussion:Sebastian Schulz", "DE", "DE", "Germany" }, new Object[] { "Алиса в Зазеркалье", "NO", "NO", "Norway" }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) SelectorFilter(org.apache.druid.segment.filter.SelectorFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) ExpressionDimFilter(org.apache.druid.query.filter.ExpressionDimFilter) Filter(org.apache.druid.query.filter.Filter) SelectorDimFilter(org.apache.druid.query.filter.SelectorDimFilter) OrDimFilter(org.apache.druid.query.filter.OrDimFilter) Test(org.junit.Test)

Aggregations

JoinFilterPreAnalysis (org.apache.druid.segment.join.filter.JoinFilterPreAnalysis)79 Test (org.junit.Test)74 Filter (org.apache.druid.query.filter.Filter)63 ExpressionDimFilter (org.apache.druid.query.filter.ExpressionDimFilter)61 SelectorFilter (org.apache.druid.segment.filter.SelectorFilter)61 InDimFilter (org.apache.druid.query.filter.InDimFilter)36 BoundDimFilter (org.apache.druid.query.filter.BoundDimFilter)35 AndFilter (org.apache.druid.segment.filter.AndFilter)35 BoundFilter (org.apache.druid.segment.filter.BoundFilter)35 FalseFilter (org.apache.druid.segment.filter.FalseFilter)35 OrFilter (org.apache.druid.segment.filter.OrFilter)35 JoinFilterSplit (org.apache.druid.segment.join.filter.JoinFilterSplit)35 OrDimFilter (org.apache.druid.query.filter.OrDimFilter)26 SelectorDimFilter (org.apache.druid.query.filter.SelectorDimFilter)26 IndexedTableJoinable (org.apache.druid.segment.join.table.IndexedTableJoinable)19 JoinFilterPreAnalysisKey (org.apache.druid.segment.join.filter.JoinFilterPreAnalysisKey)7 ExpressionVirtualColumn (org.apache.druid.segment.virtual.ExpressionVirtualColumn)7 JoinFilterRewriteConfig (org.apache.druid.segment.join.filter.rewrite.JoinFilterRewriteConfig)6 VirtualColumns (org.apache.druid.segment.VirtualColumns)5 ArrayList (java.util.ArrayList)3