Search code examples
sqlapache-drill

Cant Create table in Drill


I never had an issue creating a table on RDBMS. But this drill thing is really weird - i cant create new empty tables

I was following Apache Drill guide for creating table which i don't get why isn't it working like

first:

0: jdbc:drill:zk=local> USE s3XXXXX.dss;
+-------+---------------------------------------------+
|  ok   |                   summary                   |
+-------+---------------------------------------------+
| true  | Default schema changed to [s3XXXXX.dss]  |
+-------+---------------------------------------------+
1 row selected (0.172 seconds)

And now for the Create commnad:

0: jdbc:drill:zk=local> CREATE TABLE  s3XXXXX.dss.`name_key` (NBVXA ) AS QUERY;
Jun 11, 2017 10:53:28 PM org.apache.calcite.runtime.CalciteException <init>
SEVERE: org.apache.calcite.runtime.CalciteException: Non-query expression encountered in illegal context
Jun 11, 2017 10:53:28 PM org.apache.calcite.runtime.CalciteException <init>
SEVERE: org.apache.calcite.runtime.CalciteContextException: From line 1, column 53 to line 1, column 57: Non-query expression encountered in illegal context
Error: PARSE ERROR: Non-query expression encountered in illegal context

SQL Query CREATE TABLE  s3XXXXX.dss.`name_key` (NBVXA ) AS QUERY

Solution

  • its a bit fishy, But i have found this solution which is close enough:

    CREATE TABLE  s3xxxxxx.dss.`name_key3`   as  SELECT DATE_PART('day', '2015-04-02') xx FROM (VALUES(1)) ;