From d6c07270a58ac93c7578eb0754d9efdfdd76c8d3 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Thu, 11 Jul 2024 04:26:07 -0700 Subject: [PATCH] fix issues with join filter pushdown and virtual column resolution (#16702) --- .../apache/druid/segment/VirtualColumns.java | 57 +++++++------ .../join/HashJoinSegmentStorageAdapter.java | 85 +++++-------------- .../join/filter/JoinFilterAnalyzer.java | 25 ++---- .../join/filter/JoinFilterPreAnalysis.java | 10 +-- .../join/filter/JoinFilterPreAnalysisKey.java | 1 + .../segment/join/filter/JoinableClauses.java | 15 ++-- .../HashJoinSegmentStorageAdapterTest.java | 38 --------- .../segment/join/JoinFilterAnalyzerTest.java | 77 +++++++++-------- 8 files changed, 119 insertions(+), 189 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java b/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java index 583f0425c2a..79354a4fa2a 100644 --- a/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java +++ b/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java @@ -48,13 +48,12 @@ import org.apache.druid.segment.virtual.VirtualizedColumnInspector; import org.apache.druid.segment.virtual.VirtualizedColumnSelectorFactory; import javax.annotation.Nullable; - +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; /** * Class allowing lookup and usage of virtual columns. @@ -86,11 +85,21 @@ public class VirtualColumns implements Cacheable } @JsonCreator - public static VirtualColumns create(List virtualColumns) + public static VirtualColumns create(@Nullable List virtualColumns) { if (virtualColumns == null || virtualColumns.isEmpty()) { return EMPTY; } + return fromIterable(virtualColumns); + } + + public static VirtualColumns create(VirtualColumn... virtualColumns) + { + return create(Arrays.asList(virtualColumns)); + } + + public static VirtualColumns fromIterable(Iterable virtualColumns) + { Map withDotSupport = new HashMap<>(); Map withoutDotSupport = new HashMap<>(); for (VirtualColumn vc : virtualColumns) { @@ -115,11 +124,6 @@ public class VirtualColumns implements Cacheable return new VirtualColumns(ImmutableList.copyOf(virtualColumns), withDotSupport, withoutDotSupport); } - public static VirtualColumns create(VirtualColumn... virtualColumns) - { - return create(Arrays.asList(virtualColumns)); - } - public static VirtualColumns nullToEmpty(@Nullable VirtualColumns virtualColumns) { return virtualColumns == null ? EMPTY : virtualColumns; @@ -134,6 +138,14 @@ public class VirtualColumns implements Cacheable } } + // For equals, hashCode, toString, and serialization: + private final List virtualColumns; + private final List virtualColumnNames; + + // For getVirtualColumn: + private final Map withDotSupport; + private final Map withoutDotSupport; + private VirtualColumns( List virtualColumns, Map withDotSupport, @@ -143,19 +155,14 @@ public class VirtualColumns implements Cacheable this.virtualColumns = virtualColumns; this.withDotSupport = withDotSupport; this.withoutDotSupport = withoutDotSupport; + this.virtualColumnNames = new ArrayList<>(virtualColumns.size()); for (VirtualColumn virtualColumn : virtualColumns) { detectCycles(virtualColumn, null); + virtualColumnNames.add(virtualColumn.getOutputName()); } } - // For equals, hashCode, toString, and serialization: - private final List virtualColumns; - - // For getVirtualColumn: - private final Map withDotSupport; - private final Map withoutDotSupport; - /** * Returns true if a virtual column exists with a particular columnName. * @@ -468,6 +475,16 @@ public class VirtualColumns implements Cacheable return new CacheKeyBuilder((byte) 0).appendCacheablesIgnoringOrder(virtualColumns).build(); } + public boolean isEmpty() + { + return virtualColumns.isEmpty(); + } + + public List getColumnNames() + { + return virtualColumnNames; + } + private VirtualColumn getVirtualColumnForSelector(String columnName) { VirtualColumn virtualColumn = getVirtualColumn(columnName); @@ -538,14 +555,4 @@ public class VirtualColumns implements Cacheable ((VirtualColumns) obj).virtualColumns.isEmpty(); } } - - public boolean isEmpty() - { - return virtualColumns.isEmpty(); - } - - public List getColumnNames() - { - return virtualColumns.stream().map(v -> v.getOutputName()).collect(Collectors.toList()); - } } diff --git a/processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java b/processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java index c7126448112..fd9c07a253f 100644 --- a/processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java +++ b/processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java @@ -19,7 +19,10 @@ package org.apache.druid.segment.join; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import org.apache.druid.java.util.common.ISE; import org.apache.druid.java.util.common.granularity.Granularity; import org.apache.druid.java.util.common.guava.Sequence; @@ -30,7 +33,6 @@ import org.apache.druid.query.filter.Filter; import org.apache.druid.segment.Cursor; import org.apache.druid.segment.Metadata; import org.apache.druid.segment.StorageAdapter; -import org.apache.druid.segment.VirtualColumn; import org.apache.druid.segment.VirtualColumns; import org.apache.druid.segment.column.ColumnCapabilities; import org.apache.druid.segment.data.Indexed; @@ -46,13 +48,10 @@ import org.joda.time.Interval; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; -import java.util.Set; public class HashJoinSegmentStorageAdapter implements StorageAdapter { @@ -292,43 +291,40 @@ public class HashJoinSegmentStorageAdapter implements StorageAdapter ); final JoinFilterPreAnalysisKey keyCached = joinFilterPreAnalysis.getKey(); - final JoinFilterSplit joinFilterSplit; - + final JoinFilterPreAnalysis preAnalysis; if (keyIn.equals(keyCached)) { // Common case: key used during filter pre-analysis (keyCached) matches key implied by makeCursors call (keyIn). - joinFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis, baseFilter); + preAnalysis = joinFilterPreAnalysis; } else { // Less common case: key differs. Re-analyze the filter. This case can happen when an unnest datasource is // layered on top of a join datasource. - joinFilterSplit = JoinFilterAnalyzer.splitFilter( - JoinFilterAnalyzer.computeJoinFilterPreAnalysis(keyIn), - baseFilter - ); + preAnalysis = JoinFilterAnalyzer.computeJoinFilterPreAnalysis(keyIn); } - final List preJoinVirtualColumns = new ArrayList<>(); - final List postJoinVirtualColumns = new ArrayList<>(); - determineBaseColumnsWithPreAndPostJoinVirtualColumns( - virtualColumns, - preJoinVirtualColumns, - postJoinVirtualColumns + final JoinFilterSplit joinFilterSplit = JoinFilterAnalyzer.splitFilter( + preAnalysis, + baseFilter ); - // We merge the filter on base table specified by the user and filter on the base table that is pushed from - // the join - preJoinVirtualColumns.addAll(joinFilterSplit.getPushDownVirtualColumns()); - final Sequence baseCursorSequence = baseAdapter.makeCursors( joinFilterSplit.getBaseTableFilter().isPresent() ? joinFilterSplit.getBaseTableFilter().get() : null, interval, - VirtualColumns.create(preJoinVirtualColumns), + VirtualColumns.fromIterable( + Iterables.concat( + Sets.difference( + ImmutableSet.copyOf(virtualColumns.getVirtualColumns()), + joinFilterPreAnalysis.getPostJoinVirtualColumns() + ), + joinFilterSplit.getPushDownVirtualColumns() + ) + ), gran, descending, queryMetrics ); - Closer joinablesCloser = Closer.create(); + final Closer joinablesCloser = Closer.create(); return Sequences.map( baseCursorSequence, cursor -> { @@ -341,7 +337,7 @@ public class HashJoinSegmentStorageAdapter implements StorageAdapter return PostJoinCursor.wrap( retVal, - VirtualColumns.create(postJoinVirtualColumns), + VirtualColumns.fromIterable(preAnalysis.getPostJoinVirtualColumns()), joinFilterSplit.getJoinTableFilter().orElse(null) ); } @@ -357,47 +353,6 @@ public class HashJoinSegmentStorageAdapter implements StorageAdapter return !getClauseForColumn(column).isPresent(); } - /** - * Return a String set containing the name of columns that belong to the base table (including any pre-join virtual - * columns as well). - * - * Additionally, if the preJoinVirtualColumns and/or postJoinVirtualColumns arguments are provided, this method - * will add each VirtualColumn in the provided virtualColumns to either preJoinVirtualColumns or - * postJoinVirtualColumns based on whether the virtual column is pre-join or post-join. - * - * @param virtualColumns List of virtual columns from the query - * @param preJoinVirtualColumns If provided, virtual columns determined to be pre-join will be added to this list - * @param postJoinVirtualColumns If provided, virtual columns determined to be post-join will be added to this list - * - * @return The set of base column names, including any pre-join virtual columns. - */ - public Set determineBaseColumnsWithPreAndPostJoinVirtualColumns( - VirtualColumns virtualColumns, - @Nullable List preJoinVirtualColumns, - @Nullable List postJoinVirtualColumns - ) - { - final Set baseColumns = new HashSet<>(baseAdapter.getRowSignature().getColumnNames()); - - for (VirtualColumn virtualColumn : virtualColumns.getVirtualColumns()) { - // Virtual columns cannot depend on each other, so we don't need to check transitive dependencies. - if (baseColumns.containsAll(virtualColumn.requiredColumns())) { - // Since pre-join virtual columns can be computed using only base columns, we include them in the - // base column set. - baseColumns.add(virtualColumn.getOutputName()); - if (preJoinVirtualColumns != null) { - preJoinVirtualColumns.add(virtualColumn); - } - } else { - if (postJoinVirtualColumns != null) { - postJoinVirtualColumns.add(virtualColumn); - } - } - } - - return baseColumns; - } - /** * Returns the JoinableClause corresponding to a particular column, based on the clauses' prefixes. * diff --git a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterAnalyzer.java b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterAnalyzer.java index a4c06e79826..d1641770fa8 100644 --- a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterAnalyzer.java +++ b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterAnalyzer.java @@ -69,8 +69,8 @@ import java.util.Set; * * The result of this pre-analysis method should be passed into the next step of join filter analysis, described below. * - * The {@link #splitFilter(JoinFilterPreAnalysis)} method takes the pre-analysis result and optionally applies the - * filter rewrite and push down operations on a per-segment level. + * The {@link #splitFilter(JoinFilterPreAnalysis, Filter)} method takes the pre-analysis result and optionally applies + * the filter rewrite and push down operations on a per-segment level. */ public class JoinFilterAnalyzer { @@ -90,11 +90,10 @@ public class JoinFilterAnalyzer */ public static JoinFilterPreAnalysis computeJoinFilterPreAnalysis(final JoinFilterPreAnalysisKey key) { - final List preJoinVirtualColumns = new ArrayList<>(); - final List postJoinVirtualColumns = new ArrayList<>(); - final JoinableClauses joinableClauses = JoinableClauses.fromList(key.getJoinableClauses()); - joinableClauses.splitVirtualColumns(key.getVirtualColumns(), preJoinVirtualColumns, postJoinVirtualColumns); + final Set postJoinVirtualColumns = joinableClauses.getPostJoinVirtualColumns( + key.getVirtualColumns() + ); final JoinFilterPreAnalysis.Builder preAnalysisBuilder = new JoinFilterPreAnalysis.Builder(key, postJoinVirtualColumns); @@ -159,13 +158,6 @@ public class JoinFilterAnalyzer return preAnalysisBuilder.withCorrelations(correlations).build(); } - public static JoinFilterSplit splitFilter( - JoinFilterPreAnalysis joinFilterPreAnalysis - ) - { - return splitFilter(joinFilterPreAnalysis, null); - } - /** * @param joinFilterPreAnalysis The pre-analysis computed by {@link #computeJoinFilterPreAnalysis)} * @param baseFilter - Filter on base table that was specified in the query itself @@ -210,7 +202,8 @@ public class JoinFilterAnalyzer ); if (joinFilterAnalysis.isCanPushDown()) { //noinspection OptionalGetWithoutIsPresent isCanPushDown checks isPresent - leftFilters.add(joinFilterAnalysis.getPushDownFilter().get()); + final Filter pushDown = joinFilterAnalysis.getPushDownFilter().get(); + leftFilters.add(pushDown); } if (joinFilterAnalysis.isRetainAfterJoin()) { rightFilters.add(joinFilterAnalysis.getOriginalFilter()); @@ -519,7 +512,7 @@ public class JoinFilterAnalyzer } private static boolean isColumnFromPostJoinVirtualColumns( - List postJoinVirtualColumns, + Set postJoinVirtualColumns, String column ) { @@ -532,7 +525,7 @@ public class JoinFilterAnalyzer } private static boolean areSomeColumnsFromPostJoinVirtualColumns( - List postJoinVirtualColumns, + Set postJoinVirtualColumns, Collection columns ) { diff --git a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysis.java b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysis.java index b8b2e7c7830..b63b72c9f96 100644 --- a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysis.java +++ b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysis.java @@ -50,12 +50,12 @@ public class JoinFilterPreAnalysis private final List normalizedBaseTableClauses; private final List normalizedJoinTableClauses; private final JoinFilterCorrelations correlations; - private final List postJoinVirtualColumns; + private final Set postJoinVirtualColumns; private final Equiconditions equiconditions; private JoinFilterPreAnalysis( final JoinFilterPreAnalysisKey key, - final List postJoinVirtualColumns, + final Set postJoinVirtualColumns, final List normalizedBaseTableClauses, final List normalizedJoinTableClauses, final JoinFilterCorrelations correlations, @@ -86,7 +86,7 @@ public class JoinFilterPreAnalysis return key.getFilter(); } - public List getPostJoinVirtualColumns() + public Set getPostJoinVirtualColumns() { return postJoinVirtualColumns; } @@ -140,13 +140,13 @@ public class JoinFilterPreAnalysis @Nullable private JoinFilterCorrelations correlations; @Nonnull - private final List postJoinVirtualColumns; + private final Set postJoinVirtualColumns; @Nonnull private Equiconditions equiconditions = new Equiconditions(Collections.emptyMap()); public Builder( @Nonnull JoinFilterPreAnalysisKey key, - @Nonnull List postJoinVirtualColumns + @Nonnull Set postJoinVirtualColumns ) { this.key = key; diff --git a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysisKey.java b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysisKey.java index fe863b0fd5b..48c00421b54 100644 --- a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysisKey.java +++ b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinFilterPreAnalysisKey.java @@ -68,6 +68,7 @@ public class JoinFilterPreAnalysisKey return virtualColumns; } + @Nullable public Filter getFilter() { return filter; diff --git a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinableClauses.java b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinableClauses.java index 254d4edc50a..fbf457c55a0 100644 --- a/processing/src/main/java/org/apache/druid/segment/join/filter/JoinableClauses.java +++ b/processing/src/main/java/org/apache/druid/segment/join/filter/JoinableClauses.java @@ -32,8 +32,10 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; public class JoinableClauses @@ -88,19 +90,20 @@ public class JoinableClauses return joinableClauses; } - public void splitVirtualColumns( - final VirtualColumns virtualColumns, - final List preJoinVirtualColumns, - final List postJoinVirtualColumns + /** + * Retrieve subset of virtual columns which require inputs which are only present on the join table + */ + public Set getPostJoinVirtualColumns( + final VirtualColumns virtualColumns ) { + final Set postJoinVirtualColumns = new HashSet<>(); for (VirtualColumn virtualColumn : virtualColumns.getVirtualColumns()) { if (areSomeColumnsFromJoin(virtualColumn.requiredColumns())) { postJoinVirtualColumns.add(virtualColumn); - } else { - preJoinVirtualColumns.add(virtualColumn); } } + return postJoinVirtualColumns; } public boolean areSomeColumnsFromJoin( diff --git a/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapterTest.java b/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapterTest.java index 20d032aba38..5931bff8359 100644 --- a/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapterTest.java @@ -33,7 +33,6 @@ import org.apache.druid.query.filter.Filter; import org.apache.druid.query.filter.InDimFilter; import org.apache.druid.query.filter.OrDimFilter; import org.apache.druid.query.filter.SelectorDimFilter; -import org.apache.druid.segment.VirtualColumn; import org.apache.druid.segment.VirtualColumns; import org.apache.druid.segment.column.ColumnCapabilities; import org.apache.druid.segment.column.ValueType; @@ -45,7 +44,6 @@ import org.apache.druid.segment.join.table.IndexedTableJoinable; import org.junit.Assert; import org.junit.Test; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -2294,42 +2292,6 @@ public class HashJoinSegmentStorageAdapterTest extends BaseHashJoinSegmentStorag ); } - @Test - public void test_determineBaseColumnsWithPreAndPostJoinVirtualColumns() - { - List joinableClauses = ImmutableList.of(factToCountryOnIsoCode(JoinType.LEFT)); - JoinFilterPreAnalysis analysis = makeDefaultConfigPreAnalysis(null, joinableClauses, VirtualColumns.EMPTY); - HashJoinSegmentStorageAdapter adapter = new HashJoinSegmentStorageAdapter( - factSegment.asStorageAdapter(), - joinableClauses, - analysis - ); - List expectedPreJoin = ImmutableList.of( - makeExpressionVirtualColumn("concat(countryIsoCode,'L')", "v0"), - makeExpressionVirtualColumn("concat(countryIsoCode, countryNumber)", "v1"), - makeExpressionVirtualColumn("channel_uniques - 1", "v2"), - makeExpressionVirtualColumn("channel_uniques - __time", "v3") - ); - - List expectedPostJoin = ImmutableList.of( - makeExpressionVirtualColumn("concat(countryIsoCode, dummyColumn)", "v4"), - makeExpressionVirtualColumn("dummyMetric - __time", "v5") - ); - List actualPreJoin = new ArrayList<>(); - List actualPostJoin = new ArrayList<>(); - List allVirtualColumns = new ArrayList<>(); - allVirtualColumns.addAll(expectedPreJoin); - allVirtualColumns.addAll(expectedPostJoin); - adapter.determineBaseColumnsWithPreAndPostJoinVirtualColumns( - VirtualColumns.create(allVirtualColumns), - actualPreJoin, - actualPostJoin - ); - - Assert.assertEquals(expectedPreJoin, actualPreJoin); - Assert.assertEquals(expectedPostJoin, actualPostJoin); - } - @Test public void test_hasBuiltInFiltersForSingleJoinableClauseWithVariousJoinTypes() { diff --git a/processing/src/test/java/org/apache/druid/segment/join/JoinFilterAnalyzerTest.java b/processing/src/test/java/org/apache/druid/segment/join/JoinFilterAnalyzerTest.java index 1b7f250f847..68a77f38884 100644 --- a/processing/src/test/java/org/apache/druid/segment/join/JoinFilterAnalyzerTest.java +++ b/processing/src/test/java/org/apache/druid/segment/join/JoinFilterAnalyzerTest.java @@ -119,7 +119,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes null, ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -183,7 +183,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes new SelectorFilter("rtc.countryName", "United States"), ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -249,7 +249,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -320,7 +320,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -382,7 +382,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -461,7 +461,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -521,7 +521,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -685,7 +685,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -758,7 +758,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); ExpressionVirtualColumn expectedVirtualColumn = new ExpressionVirtualColumn( "JOIN-FILTER-PUSHDOWN-VIRTUAL-COLUMN-0", @@ -933,7 +933,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1013,7 +1013,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ) ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals( expectedFilterSplit.getBaseTableFilter(), actualFilterSplit.getBaseTableFilter() @@ -1103,7 +1103,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ) ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals( expectedFilterSplit.getBaseTableFilter(), actualFilterSplit.getBaseTableFilter() @@ -1171,7 +1171,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1228,7 +1228,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1284,7 +1284,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1341,7 +1341,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1396,7 +1396,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1460,7 +1460,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1523,7 +1523,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1578,7 +1578,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1632,7 +1632,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1690,7 +1690,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1747,7 +1747,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1803,7 +1803,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1858,7 +1858,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1924,7 +1924,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -1995,7 +1995,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2074,7 +2074,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2133,7 +2133,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2241,7 +2241,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2494,7 +2494,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes expectedVirtualColumns ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2556,7 +2556,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2630,7 +2630,7 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); + JoinFilterSplit actualFilterSplit = split(joinFilterPreAnalysis); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } @@ -2674,7 +2674,16 @@ public class JoinFilterAnalyzerTest extends BaseHashJoinSegmentStorageAdapterTes null, ImmutableSet.of() ); - JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis, baseTableFilter); + JoinFilterSplit actualFilterSplit = JoinFilterAnalyzer.splitFilter( + joinFilterPreAnalysis, + baseTableFilter + ); Assert.assertEquals(expectedFilterSplit, actualFilterSplit); } + + + private JoinFilterSplit split(JoinFilterPreAnalysis preAnalysis) + { + return JoinFilterAnalyzer.splitFilter(preAnalysis, null); + } }