Aman Sinha created DRILL-1449:
---------------------------------

             Summary: CTAS in JSON format creates a table even when the SELECT 
query fails
                 Key: DRILL-1449
                 URL: https://issues.apache.org/jira/browse/DRILL-1449
             Project: Apache Drill
          Issue Type: Bug
          Components: Storage - JSON
    Affects Versions: 0.6.0
            Reporter: Aman Sinha


When a CTAS command fails for any reason, it should not create the target  
table. It appears that when the storage output format is JSON,  we end up 
creating an empty table.  If the output format is Parquet, this works 
correctly. 

0: jdbc:drill:zk=local> alter session set `store.format` = 'json';
..
0: jdbc:drill:zk=local> create table orders3 as select * from 
cp.`tpch/orders.parquet` where o_orderdate between '1994-07-01' and 
'1994-09-31' limit 10;
Query failed: Failure while running fragment. Value 31 for dayOfMonth must be 
in the range [1,30] 

// Now fix the query and re-run : 

0: jdbc:drill:zk=local> create table orders3 as select * from 
cp.`tpch/orders.parquet` where o_orderdate between '1994-07-01' and 
'1994-09-30' limit 10;
+------------+------------+
|     ok     |  summary   |
+------------+------------+
| false      | Table 'orders3' already exists. |
+------------+------------+

0: jdbc:drill:zk=local> select * from orders3;
+--+
|  |
+--+
+--+
No rows selected



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to