This is an automated email from the ASF dual-hosted git repository.

larsh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a0eb3e  PHOENIX-5116 DistinctPrefixFilterIT fails.
8a0eb3e is described below

commit 8a0eb3e5e62e168581c8c0732519c1f0d8027121
Author: Lars Hofhansl <la...@apache.org>
AuthorDate: Thu Jan 31 09:47:36 2019 -0800

    PHOENIX-5116 DistinctPrefixFilterIT fails.
---
 .../src/main/java/org/apache/phoenix/compile/ScanRanges.java     | 9 ++++++++-
 .../main/java/org/apache/phoenix/optimize/QueryOptimizer.java    | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index 1732fce..2a7dbb4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -535,7 +535,14 @@ public class ScanRanges {
     public boolean isPointLookup() {
         return isPointLookup;
     }
-    
+
+    /**
+     * @return true if this range is salted - i.e. has a salt range
+     */
+    public boolean isSalted() {
+        return isSalted;
+    }
+
     public int getPointLookupCount() {
         return getPointLookupCount(isPointLookup, ranges);
     }
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
index 4e5ace8..d734251 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
@@ -517,8 +517,8 @@ public class QueryOptimizer {
                 boundCount2 += table2.getViewIndexId() == null ? 0 : 
(boundRanges - 1);
                 // Adjust for salting. Salting adds a bound range for each 
salt bucket.
                 // (but the sum of buckets cover the entire table)
-                boundCount1 -= table1.getBucketNum() == null ? 0 : 1;
-                boundCount2 -= table2.getBucketNum() == null ? 0 : 1;
+                boundCount1 -= plan1.getContext().getScanRanges().isSalted() ? 
1 : 0;
+                boundCount2 -= plan2.getContext().getScanRanges().isSalted() ? 
1 : 0;
                 int c = boundCount2 - boundCount1;
                 if (c != 0) return c;
                 if (plan1.getGroupBy() != null && plan2.getGroupBy() != null) {

Reply via email to