Hi, Stefan
> is it possible that your JSON serializer is not escaping characters that
> should be escaped?
No. I confirmed my JSON, but it isn't.
More simply, I tested like bellow.
Query:
select * from dfs.root.`test.json`
where a like 'test%'
Target JSON:
{"a": "test value"}
=> Returns this record.
Target JSON:
I edited same file and insert '\n ' to value.
{"a": "test \n value"}
=> No result found.
# This is valid JSON, I believe.... isn't it?
Target JSON:
Same file with copied row and edited.
{"a": "test value"}
{"a": "test \n value"}
=> Returns 1 record ("test value")
Thank you.
--
Miura, Masahide
-----Original Message-----
From: Stefán Baxter [mailto:[email protected]]
Sent: Wednesday, January 06, 2016 4:54 PM
To: user
Subject: Re: Does drill recognize new line correctly?
Hi,
I'm not the right person to give you an answer from the Drill perspective but
is it possible that your JSON serializer is not escaping characters that should
be escaped?
please see:
-
http://stackoverflow.com/questions/4253367/how-to-escape-a-json-string-containing-newline-characters-using-javascript
-
http://stackoverflow.com/questions/5506000/javascript-json-stringify-doesnt-escap
Regards,
-Stefan
On Wed, Jan 6, 2016 at 4:10 AM, <[email protected]> wrote:
> Happy new year!
> We, Japanese like new year's greeting ;-)
>
> There's two issues in this message.
>
> First, CSV file which has value includes new line.
> The other, JSON file which has value includes new line.
>
> 1) CSV
> Doesn't drill recognize CSV which has some columns including new line?
> For example, CSV file exported from MS-Excel.
>
> I tried some patterns. Quoting column, escaping by \ (like \[LF]),
> replacing \r or \n...
> But all of those are not good for me.
>
> By the way, new lines are approved in CSV columns by RFC, you know.
> * https://tools.ietf.org/html/rfc4180
> Then I would like to parse such CSV though I know it is
> informational definition.
>
> 2) JSON
> It can't query correctly to JSON with records include new line.
>
> JSON:
> { "key": "test record with \n newline" }
>
> Query:
> select * from dfs.`test.json` where key like 'test%'
>
> Result:
> No result found
>
> It doesn't compare value correctly if it includes new line, I think.
>
> Do you know how to use new lines in values as expected?
>
> Thank you.
>
> --
> Miura, Masahide
>
>