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

CTAS (JSON) creates unreadable files when writing empty arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.0.0
    • Storage - JSON
    • None

    Description

      Source JSON file:

      {
      "a": "A1",
      "b": [ "B1", "B2" ],
      "c": [ "C1", "C2" ]
      }
      {
      "a": "A2",
      "b": [ "B3" ],
      "c": []
      }

      > select * from `file.json` ;
      --------------------------------

      a b c

      --------------------------------

      A1 ["B1","B2"] ["C1","C2"]
      A2 ["B3"] []

      --------------------------------
      2 rows selected (0.039 seconds)

      >alter session set `store.format` = 'json';

      > create table file_json as select * from `file.json` ;
      [Success]

      Created file contents:

      {
      "a" : "A1",
      "b" : [ "B1", "B2" ],
      "c" : [ "C1", "C2" ]
      }

      { "a" : "A2", "b" : [ "B3" ], "c" } This file cannot be read by Drill as the object "c" is not in key:value format: > select * from file_json ; Query failed: Query stopped., Unexpected character ('}

      ' (code 125)): was expecting a colon to separate field name and value
      at [Source: org.apache.drill.exec.vector.complex.fn.JsonReader@67b4040a; line: 8, column: 2] [ 64bb2b5d-5d83-4ae3-a7dc-7a7e44b28bf5 on abhi8.qa.lab:31010 ]
      Error: exception while executing query: Failure while executing query. (state=,code=0)

      Log attached.

      Attachments

        1. DRILL-2221.1.patch.txt
          3 kB
          Sudheesh Katkam
        2. drillbit_empty_array.log
          16 kB
          Abhishek Girish

        Activity

          People

            jaltekruse Jason Altekruse
            agirish Abhishek Girish
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: