Search in sources :

Example 66 with JoinFilterPreAnalysis

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

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryLeft_filterExcludesAllLeftRowsUsingLookup.

@Test
public void test_makeCursors_factToCountryLeft_filterExcludesAllLeftRowsUsingLookup() {
    Filter originalFilter = new SelectorFilter("page", "this matches nothing");
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryNameUsingIsoCodeLookup(JoinType.LEFT));
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(originalFilter, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(originalFilter, 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());
}
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 67 with JoinFilterPreAnalysis

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

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryLeftWithFilterOnJoinable.

@Test
public void test_makeCursors_factToCountryLeftWithFilterOnJoinable() {
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryOnIsoCode(JoinType.LEFT));
    Filter filter = new OrDimFilter(new SelectorDimFilter(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryIsoCode", "DE", null), new SelectorDimFilter(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName", "Norway", null), new SelectorDimFilter(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryNumber", "10", 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 + "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryNumber"), ImmutableList.of(new Object[] { "Mathis Bolly", "MX", "MX", "Mexico", 10L }, new Object[] { "Diskussion:Sebastian Schulz", "DE", "DE", "Germany", 3L }, new Object[] { "Алиса в Зазеркалье", "NO", "NO", "Norway", 11L }));
}
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)

Example 68 with JoinFilterPreAnalysis

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

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryAlwaysTrue.

@Test
public void test_makeCursors_factToCountryAlwaysTrue() {
    List<JoinableClause> joinableClauses = ImmutableList.of(new JoinableClause(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX, new IndexedTableJoinable(countriesTable), JoinType.LEFT, JoinConditionAnalysis.forExpression("1", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX, ExprMacroTable.nil())));
    Filter filter = new SelectorDimFilter("channel", "#de.wikipedia", 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", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName"), ImmutableList.of(new Object[] { "Diskussion:Sebastian Schulz", "Australia" }, new Object[] { "Diskussion:Sebastian Schulz", "Canada" }, new Object[] { "Diskussion:Sebastian Schulz", "Chile" }, new Object[] { "Diskussion:Sebastian Schulz", "Germany" }, new Object[] { "Diskussion:Sebastian Schulz", "Ecuador" }, new Object[] { "Diskussion:Sebastian Schulz", "France" }, new Object[] { "Diskussion:Sebastian Schulz", "United Kingdom" }, new Object[] { "Diskussion:Sebastian Schulz", "Italy" }, new Object[] { "Diskussion:Sebastian Schulz", "Japan" }, new Object[] { "Diskussion:Sebastian Schulz", "Republic of Korea" }, new Object[] { "Diskussion:Sebastian Schulz", "Mexico" }, new Object[] { "Diskussion:Sebastian Schulz", "Norway" }, new Object[] { "Diskussion:Sebastian Schulz", "El Salvador" }, new Object[] { "Diskussion:Sebastian Schulz", "United States" }, new Object[] { "Diskussion:Sebastian Schulz", "Atlantis" }, new Object[] { "Diskussion:Sebastian Schulz", "States United" }, new Object[] { "Diskussion:Sebastian Schulz", "Usca" }, new Object[] { "Diskussion:Sebastian Schulz", "Fourems" }));
}
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) IndexedTableJoinable(org.apache.druid.segment.join.table.IndexedTableJoinable) Test(org.junit.Test)

Example 69 with JoinFilterPreAnalysis

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

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryInnerUsingLookup.

@Test
public void test_makeCursors_factToCountryInnerUsingLookup() {
    List<JoinableClause> joinableClauses = ImmutableList.of(factToCountryNameUsingIsoCodeLookup(JoinType.INNER));
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(null, joinableClauses, VirtualColumns.EMPTY);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(null, 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[] { "Peremptory norm", "AU", "AU", "Australia" }, new Object[] { "Mathis Bolly", "MX", "MX", "Mexico" }, new Object[] { "유희왕 GX", "KR", "KR", "Republic of Korea" }, new Object[] { "青野武", "JP", "JP", "Japan" }, new Object[] { "Golpe de Estado en Chile de 1973", "CL", "CL", "Chile" }, new Object[] { "President of India", "US", "US", "United States" }, new Object[] { "Diskussion:Sebastian Schulz", "DE", "DE", "Germany" }, new Object[] { "Saison 9 de Secret Story", "FR", "FR", "France" }, new Object[] { "Glasgow", "GB", "GB", "United Kingdom" }, new Object[] { "Didier Leclair", "CA", "CA", "Canada" }, new Object[] { "Les Argonautes", "CA", "CA", "Canada" }, new Object[] { "Otjiwarongo Airport", "US", "US", "United States" }, new Object[] { "Sarah Michelle Gellar", "CA", "CA", "Canada" }, new Object[] { "DirecTV", "US", "US", "United States" }, new Object[] { "Carlo Curti", "US", "US", "United States" }, new Object[] { "Giusy Ferreri discography", "IT", "IT", "Italy" }, new Object[] { "Roma-Bangkok", "IT", "IT", "Italy" }, new Object[] { "Wendigo", "SV", "SV", "El Salvador" }, new Object[] { "Алиса в Зазеркалье", "NO", "NO", "Norway" }, new Object[] { "Gabinete Ministerial de Rafael Correa", "EC", "EC", "Ecuador" }, new Object[] { "Old Anatolian Turkish", "US", "US", "United States" }, new Object[] { "Cream Soda", "SU", "SU", "States United" }, new Object[] { "History of Fourems", "MMMM", "MMMM", "Fourems" }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) Test(org.junit.Test)

Example 70 with JoinFilterPreAnalysis

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

the class HashJoinSegmentStorageAdapterTest method test_makeCursors_factToCountryUsingVirtualColumn.

@Test
public void test_makeCursors_factToCountryUsingVirtualColumn() {
    List<JoinableClause> joinableClauses = ImmutableList.of(new JoinableClause(FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX, new IndexedTableJoinable(countriesTable), JoinType.INNER, JoinConditionAnalysis.forExpression(StringUtils.format("\"%scountryIsoCode\" == virtual", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX), FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX, ExprMacroTable.nil())));
    VirtualColumns virtualColumns = VirtualColumns.create(Collections.singletonList(makeExpressionVirtualColumn("concat(substring(countryIsoCode, 0, 1),'L')")));
    JoinFilterPreAnalysis joinFilterPreAnalysis = makeDefaultConfigPreAnalysis(null, joinableClauses, virtualColumns);
    JoinTestHelper.verifyCursors(new HashJoinSegmentStorageAdapter(factSegment.asStorageAdapter(), joinableClauses, joinFilterPreAnalysis).makeCursors(null, Intervals.ETERNITY, virtualColumns, Granularities.ALL, false, null), ImmutableList.of("page", "countryIsoCode", "virtual", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryIsoCode", FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX + "countryName"), ImmutableList.of(new Object[] { "Golpe de Estado en Chile de 1973", "CL", "CL", "CL", "Chile" }, new Object[] { "Didier Leclair", "CA", "CL", "CL", "Chile" }, new Object[] { "Les Argonautes", "CA", "CL", "CL", "Chile" }, new Object[] { "Sarah Michelle Gellar", "CA", "CL", "CL", "Chile" }));
}
Also used : JoinFilterPreAnalysis(org.apache.druid.segment.join.filter.JoinFilterPreAnalysis) IndexedTableJoinable(org.apache.druid.segment.join.table.IndexedTableJoinable) VirtualColumns(org.apache.druid.segment.VirtualColumns) 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