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

conver_from() on JSON fails - regression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.6.0
    • 0.6.0
    • Functions - Drill
    • None

    Description

      The following query worked before, but fails with the latest master (#Fri Sep 12 14:08:02 PDT 2014
      git.commit.id.abbrev=9e16466)

      0: jdbc:drill:schema=dfs> select convert_from(convert_to(rl[1], 'JSON'), 'JSON') from `input2.json`;
      Query failed: Failure while running fragment. Failure while parsing JSON. Found token of [VALUE_NULL] Drill currently only supports parsing json strings that contain either lists or maps. The root object cannot be a scalar.
      at [Source: java.io.StringReader@3d552116; line: 1, column: 9] [8752d761-4ed4-4314-b621-e9f061849a11]

      Error: exception while executing query: Failure while trying to get next result batch. (state=,code=0)

      The input2.json file looks like this:

      [root@qa-node120 ~]# hadoop fs -cat /user/root/mondrian/input2.json
      { "integer" : 2010,
      "float" : 17.4,
      "x":

      { "y": "kevin", "z": "paul" }

      ,
      "z": [

      {"orange" : "yellow" , "pink": "red"}

      ,

      {"pink" : "purple" }

      ],
      "l": [4,2],
      "rl": [ [2,1], [4,6] ]
      }
      { "integer" : -2002,
      "float" : -1.2
      }
      { "integer" : 2001,
      "float" : 1.2,
      "x":

      { "y": "bill", "z": "peter" }

      ,
      "z": [

      {"pink" : "lilac" }

      ],
      "l": [4,2],
      "rl": [ [2,1], [4,6] ]
      }
      { "integer" : 6005,
      "float" : 1.2,
      "x":

      { "y": "mike", "z": "mary" }

      ,
      "z": [

      {"orange" : "stucco" }

      ],
      "l": [4,2],
      "rl": [ [2,1], [4,6] ]
      }

      The convert_to appears working:

      0: jdbc:drill:schema=dfs> select convert_to(rl[1], 'JSON') from `input2.json`;
      ------------

      EXPR$0

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

      [B@3a8a8b88
      [B@5dceabbe
      [B@2b6d770f
      [B@1fa3900f

      ------------
      4 rows selected (0.116 seconds)

      Attachments

        Activity

          People

            jaltekruse Jason Altekruse
            cchang@maprtech.com Chun Chang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: