You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/07/20 16:06:41 UTC

phoenix git commit: PHOENIX-3105 Support "EXPLAIN" grammar as a shorthand for "EXPLAIN PLAN FOR"

Repository: phoenix
Updated Branches:
  refs/heads/calcite 154aed6e7 -> 6a6ea2a22


PHOENIX-3105 Support "EXPLAIN" grammar as a shorthand for "EXPLAIN PLAN FOR"


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

Branch: refs/heads/calcite
Commit: 6a6ea2a22eda558fb7dfc6d09fe0df088ed0acca
Parents: 154aed6
Author: maryannxue <ma...@gmail.com>
Authored: Wed Jul 20 12:06:24 2016 -0400
Committer: maryannxue <ma...@gmail.com>
Committed: Wed Jul 20 12:06:24 2016 -0400

----------------------------------------------------------------------
 phoenix-core/src/main/codegen/data/Parser.tdd   |  7 +++---
 .../src/main/codegen/includes/parserImpls.ftl   | 25 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a6ea2a2/phoenix-core/src/main/codegen/data/Parser.tdd
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/codegen/data/Parser.tdd b/phoenix-core/src/main/codegen/data/Parser.tdd
index d034ef9..75df3fc 100644
--- a/phoenix-core/src/main/codegen/data/Parser.tdd
+++ b/phoenix-core/src/main/codegen/data/Parser.tdd
@@ -47,9 +47,10 @@
   # List of methods for parsing custom SQL statements.
   statementParserMethods: [
     "SqlCommit()",
-    "SqlCreateView()"
-    "SqlCreateTable()"
-    "SqlDropTableOrDropView()"
+    "SqlPhoenixExplain()",
+    "SqlCreateView()",
+    "SqlCreateTable()",
+    "SqlDropTableOrDropView()",
   ]
 
   # List of methods for parsing custom literals.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6a6ea2a2/phoenix-core/src/main/codegen/includes/parserImpls.ftl
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/codegen/includes/parserImpls.ftl b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
index 0bb8a90..6915ef5 100644
--- a/phoenix-core/src/main/codegen/includes/parserImpls.ftl
+++ b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
@@ -36,6 +36,31 @@ SqlNode SqlCommit() :
 }
 
 /**
+ * Parses an EXPLAIN statement.
+ * Phoenix equivalent for EXPLAIN PLAN statement.
+ */
+SqlNode SqlPhoenixExplain() :
+{
+    SqlNode stmt;
+    SqlExplainLevel detailLevel = SqlExplainLevel.EXPPLAN_ATTRIBUTES;
+    SqlExplain.Depth depth = SqlExplain.Depth.PHYSICAL;
+    SqlParserPos pos;
+    boolean asXml = false;
+}
+{
+    <EXPLAIN>
+    stmt = SqlQueryOrDml() {
+        pos = getPos();
+        return new SqlExplain(pos,
+            stmt,
+            detailLevel.symbol(SqlParserPos.ZERO),
+            depth.symbol(SqlParserPos.ZERO),
+            SqlLiteral.createBoolean(asXml, SqlParserPos.ZERO),
+            nDynamicParams);
+    }
+}
+
+/**
  * Parses statement
  *   CREATE VIEW
  */