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

CTAS for empty output doesn't create parquet file or folder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.14.0
    • 1.17.0
    • Storage - Parquet
    • None

    Description

      CTAS for empty output can create empty tables based on the empty json or csv files. But it doesn't work for parquet files.
      See examples below:

      0: jdbc:drill:zk=local> use dfs.tmp;
      +-------+--------------------------------------+
      |  ok   |               summary                |
      +-------+--------------------------------------+
      | true  | Default schema changed to [dfs.tmp]  |
      +-------+--------------------------------------+
      1 row selected (0.087 seconds)
      0: jdbc:drill:zk=local> select * from `empty_dir`;
      +--+
      |  |
      +--+
      +--+
      No rows selected (0.083 seconds)
      0: jdbc:drill:zk=local> alter session set `store.format` = 'json';
      +-------+------------------------+
      |  ok   |        summary         |
      +-------+------------------------+
      | true  | store.format updated.  |
      +-------+------------------------+
      1 row selected (0.079 seconds)
      0: jdbc:drill:zk=local> create table `empty_json` as select * from `empty_dir`;
      +-----------+----------------------------+
      | Fragment  | Number of records written  |
      +-----------+----------------------------+
      | 0_0       | 0                          |
      +-----------+----------------------------+
      1 row selected (0.128 seconds)
      0: jdbc:drill:zk=local> select * from `empty_json`;
      +--+
      |  |
      +--+
      +--+
      No rows selected (0.086 seconds)
      0: jdbc:drill:zk=local> alter session set `store.format` = 'csv';
      +-------+------------------------+
      |  ok   |        summary         |
      +-------+------------------------+
      | true  | store.format updated.  |
      +-------+------------------------+
      1 row selected (0.073 seconds)
      0: jdbc:drill:zk=local> create table `empty_csv` as select * from `empty_dir`;
      +-----------+----------------------------+
      | Fragment  | Number of records written  |
      +-----------+----------------------------+
      | 0_0       | 0                          |
      +-----------+----------------------------+
      1 row selected (0.135 seconds)
      0: jdbc:drill:zk=local> select * from `empty_csv`;
      +----------+
      | columns  |
      +----------+
      | []       |
      +----------+
      1 row selected (0.086 seconds)
      0: jdbc:drill:zk=local> alter session set `store.format` = 'parquet';
      +-------+------------------------+
      |  ok   |        summary         |
      +-------+------------------------+
      | true  | store.format updated.  |
      +-------+------------------------+
      1 row selected (0.073 seconds)
      0: jdbc:drill:zk=local> create table `empty_parquet` as select * from `empty_dir`;
      +-----------+----------------------------+
      | Fragment  | Number of records written  |
      +-----------+----------------------------+
      | 0_0       | 0                          |
      +-----------+----------------------------+
      1 row selected (0.099 seconds)
      0: jdbc:drill:zk=local> select * from `empty_parquet`;
      20:41:01.619 [23f692c1-8994-9fc8-2ce4-5fc6135ebcc9:foreman] ERROR o.a.calcite.runtime.CalciteException - org.apache.calcite.sql.validate.SqlValidatorException: Object 'empty_parquet' not found
      20:41:01.619 [23f692c1-8994-9fc8-2ce4-5fc6135ebcc9:foreman] ERROR o.a.calcite.runtime.CalciteException - org.apache.calcite.runtime.CalciteContextException: From line 1, column 15 to line 1, column 29: Object 'empty_parquet' not found
      20:41:01.622 [Client-1] ERROR o.a.calcite.runtime.CalciteException - org.apache.calcite.sql.validate.SqlValidatorException: Object 'empty_parquet' not found
      20:41:01.623 [Client-1] ERROR o.a.calcite.runtime.CalciteException - org.apache.calcite.runtime.CalciteContextException: From line 1, column 15 to line 1, column 29: Object 'empty_parquet' not found: Object 'empty_parquet' not found
      Error: VALIDATION ERROR: From line 1, column 15 to line 1, column 29: Object 'empty_parquet' not found
      
      
      [Error Id: 879730dc-aad6-4fc7-9c62-9ad8bbc99d42 on vitalii-pc:31010] (state=,code=0)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vitalii Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: