You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2016/02/17 20:59:54 UTC

[3/3] phoenix git commit: PHOENIX-2676 Cannot support join operations in scans with limit (Maryann Xue)

PHOENIX-2676 Cannot support join operations in scans with limit (Maryann Xue)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/17a47a05
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/17a47a05
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/17a47a05

Branch: refs/heads/4.x-HBase-0.98
Commit: 17a47a0563989bed8a6d2db209d96d49456a1b91
Parents: dabf887
Author: James Taylor <jt...@salesforce.com>
Authored: Wed Feb 17 11:53:11 2016 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Wed Feb 17 11:58:00 2016 -0800

----------------------------------------------------------------------
 .../coprocessor/HashJoinRegionScanner.java      | 71 +++++++++++++-------
 1 file changed, 47 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/17a47a05/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
index cdfc771..2650225 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/HashJoinRegionScanner.java
@@ -45,6 +45,7 @@ import org.apache.phoenix.schema.KeyValueSchema;
 import org.apache.phoenix.schema.ValueBitSet;
 import org.apache.phoenix.schema.tuple.ResultTuple;
 import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.util.ServerUtil;
 import org.apache.phoenix.util.TupleUtil;
 
 public class HashJoinRegionScanner implements RegionScanner {
@@ -52,6 +53,7 @@ public class HashJoinRegionScanner implements RegionScanner {
     private final RegionScanner scanner;
     private final TupleProjector projector;
     private final HashJoinInfo joinInfo;
+    private final RegionCoprocessorEnvironment env;
     private Queue<Tuple> resultQueue;
     private boolean hasMore;
     private long count;
@@ -63,6 +65,7 @@ public class HashJoinRegionScanner implements RegionScanner {
     
     @SuppressWarnings("unchecked")
     public HashJoinRegionScanner(RegionScanner scanner, TupleProjector projector, HashJoinInfo joinInfo, ImmutableBytesWritable tenantId, RegionCoprocessorEnvironment env) throws IOException {
+        this.env = env;
         this.scanner = scanner;
         this.projector = projector;
         this.joinInfo = joinInfo;
@@ -247,25 +250,35 @@ public class HashJoinRegionScanner implements RegionScanner {
 
     @Override
     public boolean nextRaw(List<Cell> result) throws IOException {
-        while (shouldAdvance()) {
-            hasMore = scanner.nextRaw(result);
-            processResults(result, false);
-            result.clear();
+        try {
+            while (shouldAdvance()) {
+                hasMore = scanner.nextRaw(result);
+                processResults(result, false);
+                result.clear();
+            }
+            
+            return nextInQueue(result);
+        } catch (Throwable t) {
+            ServerUtil.throwIOException(env.getRegion().getRegionNameAsString(), t);
+            return false; // impossible
         }
-        
-        return nextInQueue(result);
     }
 
     @Override
     public boolean nextRaw(List<Cell> result, int limit)
             throws IOException {
-        while (shouldAdvance()) {
-            hasMore = scanner.nextRaw(result, limit);
-            processResults(result, true);
-            result.clear();
+        try {
+            while (shouldAdvance()) {
+                hasMore = scanner.nextRaw(result, limit);
+                processResults(result, limit >= 0);
+                result.clear();
+            }
+            
+            return nextInQueue(result);
+        } catch (Throwable t) {
+            ServerUtil.throwIOException(env.getRegion().getRegionNameAsString(), t);
+            return false; // impossible
         }
-        
-        return nextInQueue(result);
     }
 
     @Override
@@ -280,24 +293,34 @@ public class HashJoinRegionScanner implements RegionScanner {
 
     @Override
     public boolean next(List<Cell> result) throws IOException {
-        while (shouldAdvance()) {
-            hasMore = scanner.next(result);
-            processResults(result, false);
-            result.clear();
+        try {
+            while (shouldAdvance()) {
+                hasMore = scanner.next(result);
+                processResults(result, false);
+                result.clear();
+            }
+            
+            return nextInQueue(result);
+        } catch (Throwable t) {
+            ServerUtil.throwIOException(env.getRegion().getRegionNameAsString(), t);
+            return false; // impossible
         }
-        
-        return nextInQueue(result);
     }
 
     @Override
     public boolean next(List<Cell> result, int limit) throws IOException {
-        while (shouldAdvance()) {
-            hasMore = scanner.next(result, limit);
-            processResults(result, true);
-            result.clear();
+        try {
+            while (shouldAdvance()) {
+                hasMore = scanner.next(result, limit);
+                processResults(result, limit >= 0);
+                result.clear();
+            }
+            
+            return nextInQueue(result);
+        } catch (Throwable t) {
+            ServerUtil.throwIOException(env.getRegion().getRegionNameAsString(), t);
+            return false; // impossible
         }
-        
-        return nextInQueue(result);
     }
 
     @Override