drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Rogers <par0...@yahoo.com.INVALID>
Subject Re: Error: DATA_READ ERROR: Error parsing JSON - Cannot read from the middle of a record
Date Tue, 28 Aug 2018 00:44:44 GMT
Hi Scott,

The code to handle top-level arrays is supposed to be in Drill already. I tested it for a
not-yet-committed version of the JSON parser. I thought it worked in the current version as
well...

Just checked the unit tests. We have one, TestJsonRecordReader.testContainingArray that reads
a file "listdoc.json" that looks like this:

[  {a: 4, b:6},  {a: 5, b:7}]

Since we require that all unit tests pass, I'm thinking the code works. Maybe there is something
odd about your file? The example you posted, is it the entire file? With no enclosing brackets
or anything else?

Are you reading from a file, or from a column value and using a function to decode JSON? Maybe
you can share your query?

Thanks,
- Paul

 

    On Monday, August 27, 2018, 4:58:50 PM PDT, scott <tcots8888@gmail.com> wrote: 

 
 Hi All,
I'm getting an error querying some of my json files.
The error I'm getting is: Error: DATA_READ ERROR: Error parsing JSON -
Cannot read from the middle of a record. Current token was START_ARRAY

The json files are in array format, like [ { "var1": "foo", "var2":
"bar"},{"var1": "fo", "var2": "baz"}]

I found a ticket that indicates this format is not supported by Drill yet,
DRILL-1755 <https://jira.apache.org/jira/browse/DRILL-1755> , but I find it
hard to believe there is no workaround or solution since this was reported
4 years back. Does anyone have a solution or workaround to this problem?

Thanks,
Scott
  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message