Chun Chang created DRILL-1416:
---------------------------------

             Summary: conver_from() on JSON fails - regression
                 Key: DRILL-1416
                 URL: https://issues.apache.org/jira/browse/DRILL-1416
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
    Affects Versions: 0.6.0
            Reporter: Chun Chang
            Assignee: Jinfeng Ni


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)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to