aboutsummaryrefslogtreecommitdiff
path: root/exec/jdbc
diff options
context:
space:
mode:
authorvkorukanti <venki.korukanti@gmail.com>2014-06-19 18:36:27 -0700
committerJacques Nadeau <jacques@apache.org>2014-06-20 10:56:16 -0700
commit136614fdc9bac95d48590cb39ec531da345b88fb (patch)
tree127474aee6e0b01453698560bb9891d591bd3a4d /exec/jdbc
parent2060506781a6b5f9c2dc5ce244ffb532fed556a8 (diff)
DRILL-1015: Move compound identifier converter step into Sql parser.
Currently compound identifiers are converted in DrillSqlWorker after parsing the query, but when views are expanded, we don't apply the conversion process as the view expander code is in Optiq. Fix is to move the conversion process to Sql parser it self, so that whenever a query string is parsed output SqlNode will have compound identifiers converted.
Diffstat (limited to 'exec/jdbc')
-rw-r--r--exec/jdbc/pom.xml1
-rw-r--r--exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java16
-rw-r--r--exec/jdbc/src/test/resources/nation/nation.tbl25
3 files changed, 42 insertions, 0 deletions
diff --git a/exec/jdbc/pom.xml b/exec/jdbc/pom.xml
index f19294fa1..1cb5844de 100644
--- a/exec/jdbc/pom.xml
+++ b/exec/jdbc/pom.xml
@@ -103,6 +103,7 @@
<exclude>**/*.json</exclude>
<exclude>**/git.properties</exclude>
<exclude>**/donuts-output-data.txt</exclude>
+ <exclude>**/*.tbl</exclude>
<exclude>**/derby.log</exclude>
</excludes>
</configuration>
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
index 8e7131c1e..e3f6a8eb3 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
@@ -219,6 +219,22 @@ public class TestViews extends JdbcTestQueryBase {
}
@Test
+ public void testViewWithCompoundIdentifiersInSchema() throws Exception{
+ String query = String.format("CREATE VIEW nationview AS SELECT " +
+ "cast(columns[0] AS int) n_nationkey, " +
+ "cast(columns[1] AS CHAR(25)) n_name, " +
+ "cast(columns[2] AS INT) n_regionkey, " +
+ "cast(columns[3] AS VARCHAR(152)) n_comment " +
+ "FROM dfs.`%s/src/test/resources/nation`", WORKING_PATH);
+
+ testViewHelper(
+ query,
+ "nationview",
+ "SELECT * FROM nationview LIMIT 1",
+ "n_nationkey=0; n_name=ALGERIA; n_regionkey=0; n_comment= haggle. carefully final deposits detect slyly agai");
+ }
+
+ @Test
public void testDropView() throws Exception{
JdbcAssert.withNoDefaultSchema().withConnection(new Function<Connection, Void>() {
public Void apply(Connection connection) {
diff --git a/exec/jdbc/src/test/resources/nation/nation.tbl b/exec/jdbc/src/test/resources/nation/nation.tbl
new file mode 100644
index 000000000..ed3fd5b8c
--- /dev/null
+++ b/exec/jdbc/src/test/resources/nation/nation.tbl
@@ -0,0 +1,25 @@
+0|ALGERIA|0| haggle. carefully final deposits detect slyly agai|
+1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon|
+2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special |
+3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold|
+4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d|
+5|ETHIOPIA|0|ven packages wake quickly. regu|
+6|FRANCE|3|refully final requests. regular, ironi|
+7|GERMANY|3|l platelets. regular accounts x-ray: unusual, regular acco|
+8|INDIA|2|ss excuses cajole slyly across the packages. deposits print aroun|
+9|INDONESIA|2| slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull|
+10|IRAN|4|efully alongside of the slyly final dependencies. |
+11|IRAQ|4|nic deposits boost atop the quickly final requests? quickly regula|
+12|JAPAN|2|ously. final, express gifts cajole a|
+13|JORDAN|4|ic deposits are blithely about the carefully regular pa|
+14|KENYA|0| pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t|
+15|MOROCCO|0|rns. blithely bold courts among the closely regular packages use furiously bold platelets?|
+16|MOZAMBIQUE|0|s. ironic, unusual asymptotes wake blithely r|
+17|PERU|1|platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun|
+18|CHINA|2|c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos|
+19|ROMANIA|3|ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account|
+20|SAUDI ARABIA|4|ts. silent requests haggle. closely express packages sleep across the blithely|
+21|VIETNAM|2|hely enticingly express accounts. even, final |
+22|RUSSIA|3| requests against the platelets use never according to the quickly regular pint|
+23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. carefull|
+24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be|