phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [09/30] phoenix git commit: PHOENIX-2100 Indicate in explain plan when round robin iterator is being used
Date Tue, 29 Mar 2016 19:50:42 GMT
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/1d03e02f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1d03e02f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1d03e02f

Branch: refs/heads/calcite
Commit: 1d03e02f06dac97dafe6254bd8d9b75efcccd9a7
Parents: f9c8fe8
Author: Samarth <samarth.jain@salesforce.com>
Authored: Wed Mar 2 13:33:27 2016 -0800
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Wed Mar 2 13:33:27 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/1d03e02f/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/1d03e02f/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();
+        }
+    }
 
 }


Mime
View raw message