Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-1449

CTAS in JSON format creates a table even when the SELECT query fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 0.6.0
    • Future
    • Storage - JSON
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              amansinha100 Aman Sinha
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: