Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Drill >> mail # dev >> [3/4] git commit: DRILL-392: Support SHOW TABLES/SCHEMAS and DESCRIBE TABLE.


Copy link to this message
-
[3/4] git commit: DRILL-392: Support SHOW TABLES/SCHEMAS and DESCRIBE TABLE.
DRILL-392: Support SHOW TABLES/SCHEMAS and DESCRIBE TABLE.

Use Optiq parser template to generate Drill parser
a) exec/java-exec/pom.xml changes:
1. Write a plugin to move current existing codegen directory to target
(fmpp can't handle more than one directory as template input dir).
2. Change template directory path in fmpp plugin.
3. Extract CombinedParser.jj into target/codegen/templates directory.
4. Plugin to compile CombinedParser.jj using javacc.

b) Add parser.tdd to define values for freemarker variables in CombinedParser.jj template.
c) Define grammar and SqlCall types for new DDL statements.
d) Handlers to rewrite newly added SqlCall DDL statements as select queries from INFORMATION_SCHEMA.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/946bdb5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/946bdb5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/946bdb5c

Branch: refs/heads/master
Commit: 946bdb5cc1ef360318f9b29c072faff43f194ef6
Parents: 6d26f23
Author: vkorukanti <[EMAIL PROTECTED]>
Authored: Thu Apr 10 13:41:11 2014 -0700
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Mon Apr 21 09:26:52 2014 -0700

 exec/java-exec/pom.xml                          |  77 +++++++++-
 exec/java-exec/src/main/codegen/config.fmpp     |   5 +-
 exec/java-exec/src/main/codegen/data/Parser.tdd |  60 ++++++++
 .../src/main/codegen/includes/parserImpls.ftl   | 102 +++++++++++++
 .../drill/exec/planner/sql/DrillSqlWorker.java  |  15 +-
 .../planner/sql/handlers/DefaultSqlHandler.java |  18 ++-
 .../sql/handlers/DescribeTableHandler.java      |  88 ++++++++++++
 .../planner/sql/handlers/ExplainHandler.java    |   9 +-
 .../sql/handlers/ShowSchemasHandler.java        |  59 ++++++++
 .../planner/sql/handlers/ShowTablesHandler.java |  79 ++++++++++
 .../planner/sql/parser/DrillParserUtil.java     |  49 +++++++
 .../planner/sql/parser/SqlDescribeTable.java    |  72 ++++++++++
 .../exec/planner/sql/parser/SqlShowSchemas.java |  73 ++++++++++
 .../exec/planner/sql/parser/SqlShowTables.java  |  75 ++++++++++
 .../drill/exec/store/ischema/OptiqProvider.java |   7 +-
 .../apache/drill/jdbc/test/TestJdbcQuery.java   | 144 ++++++++++++++++++-
 16 files changed, 908 insertions(+), 24 deletions(-)
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/946bdb5c/exec/java-exec/pom.xml
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index e88fbec..60eeb1f 100644
+++ b/exec/java-exec/pom.xml
@@ -336,18 +336,66 @@
         </executions>
       </plugin>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <copy todir="${project.build.directory}/codegen">
+                  <fileset dir="src/main/codegen"/>
+                </copy>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <!-- Extract parser grammar template from optiq-core.jar and put it under
+             ${project.build.directory} where all freemarker templates are. -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.8</version>
+        <executions>
+          <execution>
+            <id>unpack-parser-template</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>net.hydromatic</groupId>
+                  <artifactId>optiq-core</artifactId>
+                  <type>jar</type>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/</outputDirectory>
+                  <includes>**/CombinedParser.jj</includes>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>com.googlecode.fmpp-maven-plugin</groupId>
         <artifactId>fmpp-maven-plugin</artifactId>
         <version>1.0</version>
         <configuration>
-          <cfgFile>src/main/codegen/config.fmpp</cfgFile>
+          <cfgFile>${project.build.directory}/codegen/config.fmpp</cfgFile>
           <outputDirectory>target/generated-sources</outputDirectory>
-          <templateDirectory>src/main/codegen/templates</templateDirectory>
+          <templateDirectory>${project.build.directory}/codegen/templates</templateDirectory>
         </configuration>
         <executions>
           <execution>
             <id>generate-fmpp-sources</id>
-            <phase>validate</phase>
+            <phase>initialize</phase>
             <goals>
               <goal>generate</goal>
             </goals>
@@ -409,7 +457,28 @@
           </execution>
         </executions>
       </plugin>
-
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>javacc-maven-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <id>javacc</id>
+            <goals>
+              <goal>javacc</goal>
+            </goals>
+            <configuration>
+              <sourceDirectory>${project.build.directory}/generated-sources/</sourceDirectory>
+              <includes>
+                <include>**/CombinedParser.jj</include>
+              </includes>
+              <lookAhead>2</lookAhead>
+              <isStatic>false</isStatic>
+              <outputDirectory>${project.build.directory}/generated-sources/</output