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

CTAS with 0 records from a SELECT query should create the table with metadata

    XMLWordPrintableJSON

Details

    Description

      Hello team,

      I create a table in Drill using CTAS as

      CREATE TABLE CTAS_TEST AS SELECT * FROM `hive.default`.`test` WHERE 1 = 0

      It runs successfully.

      But the table is not getting created as there are 0 records getting returned from the SELECT query.

      CTAS should still go ahead and create the table with the column metadata.

      When BI tools fire up multi-pass queries, with CTAS in the first query, the subsequent queries fail because of a missing table.

      In databases like SQL Server, Postgres, CTAS will create the table, even if the SELECT doesnt return any rows.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              besenthil Senthilkumar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: