phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject phoenix git commit: PHOENIX-3105 Support "EXPLAIN" grammar as a shorthand for "EXPLAIN PLAN FOR"
Date Wed, 20 Jul 2016 16:06:41 GMT
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 <maryann.xue@gmail.com>
Authored: Wed Jul 20 12:06:24 2016 -0400
Committer: maryannxue <maryann.xue@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
  */


Mime
View raw message