Description
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.
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
If we compare to Postgres "The Zinc Standard of SQL Compliance":
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)
If the CTAS is something complex it would be nice to see the query plan in advance.