diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/SearchOperatorConversion.java b/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/SearchOperatorConversion.java index e2f4c8fbf05..04e135f90e9 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/SearchOperatorConversion.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/SearchOperatorConversion.java @@ -128,7 +128,6 @@ public class SearchOperatorConversion implements SqlOperatorConversion // Compute points that occur in the complement of the range set. These are "NOT IN" points. final List notInPoints; - final List notInRexNodes; final RexNode notInRexNode; if (sarg.isPoints()) { diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/CollectComparisons.java b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/CollectComparisons.java index eb29e6cc7b8..52b518ff8cf 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/CollectComparisons.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/CollectComparisons.java @@ -37,20 +37,20 @@ import java.util.Set; * comparisons with the same {@link CollectionKey} can potentially become a single {@link CollectedType}. * For example: x = 'a', x = 'b' can become x IN ('a', 'b'). */ -public abstract class CollectComparisons +public abstract class CollectComparisons { /** - * List of {@link ExprType} that were ORed together. + * List of {@link BaseType} that were ORed together. */ - private final List orExprs; + private final List orExprs; /** * Copy of {@link #orExprs} with point comparisons collected, or a reference to the same {@link #orExprs} if there * was nothing to collect. */ - private List retVal; + private List retVal; - protected CollectComparisons(final List orExprs) + protected CollectComparisons(final List orExprs) { this.orExprs = orExprs; } @@ -58,7 +58,7 @@ public abstract class CollectComparisons collect() + public List collect() { if (retVal != null) { return retVal; @@ -69,12 +69,12 @@ public abstract class CollectComparisons>, List>> collectMap = new LinkedHashMap<>(); + final Map>, List>> collectMap = new LinkedHashMap<>(); // Group all comparisons from the "orExprs" list into the "selectors" map. for (int orExprIndex = 0; orExprIndex < orExprs.size(); orExprIndex++) { - final ExprType orExpr = orExprs.get(orExprIndex); - final Pair> selectorFound = getCollectibleComparison(orExpr); + final BaseType orExpr = orExprs.get(orExprIndex); + final Pair> selectorFound = getCollectibleComparison(orExpr); if (selectorFound != null) { final ComparisonType selector = selectorFound.lhs; @@ -92,7 +92,7 @@ public abstract class CollectComparisons>, List>> entry : collectMap.entrySet()) { + for (Map.Entry>, List>> entry : collectMap.entrySet()) { final List> comparisonList = entry.getValue(); final InDimFilter.ValuesSet values = new InDimFilter.ValuesSet(); @@ -119,12 +119,12 @@ public abstract class CollectComparisons andExprs = entry.getKey().rhs; + final List andExprs = entry.getKey().rhs; if (andExprs.isEmpty()) { retVal.add(collected); } else { - final List allComparisons = new ArrayList<>(andExprs.size() + 1); + final List allComparisons = new ArrayList<>(andExprs.size() + 1); allComparisons.addAll(andExprs); allComparisons.add(collected); retVal.add(makeAnd(allComparisons)); @@ -151,7 +151,7 @@ public abstract class CollectComparisons> getCollectibleComparison(ExprType expr); + protected abstract Pair> getCollectibleComparison(BaseType expr); /** * Given a comparison, returns its collection key, which will be used to group it together with like comparisons. @@ -177,5 +177,5 @@ public abstract class CollectComparisons exprs); + protected abstract BaseType makeAnd(List exprs); }