You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/03/02 22:29:08 UTC

phoenix git commit: PHOENIX-2100 Indicate in explain plan when round robin iterator is being used

Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 1956f8147 -> 34baf80db


PHOENIX-2100 Indicate in explain plan when round robin iterator is being used


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 34baf80db13d11f8fea764e494d769be2a158fb9
Parents: 1956f81
Author: Samarth <sa...@salesforce.com>
Authored: Wed Mar 2 13:28:55 2016 -0800
Committer: Samarth <sa...@salesforce.com>
Committed: Wed Mar 2 13:28:55 2016 -0800

----------------------------------------------------------------------
 .../phoenix/iterate/BaseResultIterators.java    |  7 ++++++
 .../org/apache/phoenix/query/QueryPlanTest.java | 25 ++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/34baf80d/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 9f3b3e6..c36a72b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -882,6 +882,13 @@ public abstract class BaseResultIterators extends ExplainTable implements Result
             }
         }
         buf.append(getName()).append(" ").append(size()).append("-WAY ");
+        try {
+            if (plan.useRoundRobinIterator()) {
+                buf.append("ROUND ROBIN ");
+            }
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        }
         explain(buf.toString(),planSteps);
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/34baf80d/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java
index 4ba4d16..b00ccc0 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java
@@ -252,5 +252,30 @@ public class QueryPlanTest extends BaseConnectionlessQueryTest {
             conn.close();
         }
     }
+    
+    @Test
+    public void testUseOfRoundRobinIteratorSurfaced() throws Exception {
+        Properties props = PropertiesUtil.deepCopy(new Properties());
+        props.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.toString(false));
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        String tableName = "testUseOfRoundRobinIteratorSurfaced".toUpperCase();
+        try {
+            conn.createStatement().execute("CREATE TABLE " + tableName + "(\n" +
+                    "                a VARCHAR NOT NULL,\n" +
+                    "                b TIMESTAMP NOT NULL,\n" +
+                    "                c VARCHAR,\n" +
+                    "                CONSTRAINT pk PRIMARY KEY (a, b DESC, c)\n" +
+                    "              ) IMMUTABLE_ROWS=true\n" +
+                    "                ,SALT_BUCKETS=20");
+            String query = "select * from " + tableName + " where a = 'a' and b >= timestamp '2016-01-28 00:00:00' and b < timestamp '2016-01-29 00:00:00'";
+            ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
+            String queryPlan = QueryUtil.getExplainPlan(rs);
+            assertEquals(
+                    "CLIENT PARALLEL 20-WAY ROUND ROBIN RANGE SCAN OVER " + tableName + " [0,'a',~'2016-01-28 23:59:59.999'] - [0,'a',~'2016-01-28 00:00:00.000']\n" + 
+                    "    SERVER FILTER BY FIRST KEY ONLY", queryPlan);
+        } finally {
+            conn.close();
+        }
+    }
 
 }