Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-12311

explain CTAS fails if the table already exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2.1
    • 2.0.0
    • Hive
    • None

    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.

      Attachments

        1. HIVE-12311.1.patch
          23 kB
          Gunther Hagleitner

        Activity

          People

            hagleitn Gunther Hagleitner
            cartershanklin Carter Shanklin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: