Carter Shanklin created HIVE-12311:
--------------------------------------

             Summary: explain CTAS fails if the table already exists
                 Key: HIVE-12311
                 URL: https://issues.apache.org/jira/browse/HIVE-12311
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 1.2.1
            Reporter: Carter Shanklin
            Priority: Minor


Explain of a CTAS will fail if the table already exists.

This is an annoyance when you're seeing if a large body of SQL queries will 
function by putting explain in front of every query. 

{code}
hive> create table temp (x int);
OK
Time taken: 0.252 seconds
hive> create table temp2 (x int);
OK
Time taken: 0.407 seconds
hive> explain create table temp as select * from temp2;
FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: 
Table already exists: mydb.temp
{code}

If we compare to Postgres "The Zinc Standard of SQL Compliance":

{code}
carter=# create table temp (x int);
CREATE TABLE
carter=# create table temp2 (x int);
CREATE TABLE
carter=# explain create table temp as select * from temp2;
                       QUERY PLAN
---------------------------------------------------------
 Seq Scan on temp2  (cost=0.00..34.00 rows=2400 width=4)
(1 row)
{code}

If the CTAS is something complex it would be nice to see the query plan in 
advance.



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

Reply via email to