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());
}
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 }));
}
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" }));
}
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" }));
}
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" }));
}
Aggregations