Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_parse parse's bad jsons #24090

Open
kgpai opened this issue Nov 19, 2024 · 2 comments
Open

json_parse parse's bad jsons #24090

kgpai opened this issue Nov 19, 2024 · 2 comments
Labels

Comments

@kgpai
Copy link
Contributor

kgpai commented Nov 19, 2024

Currently json_parse parse's json's that are verifiably bad or incomplete (See example below). In the prestissimo project we are wondering whether this behavior is something we should emulate and whether this behavior is something customers expect.
Secondly as you can see (row 2 vs row 3 in example below) the behavior with bad json's is also not consistent.

Expected Behavior

It would be easier and more consistent if Presto just threw on bad or incomplete json's rather than returning partial results.

Current Behavior

Below is a snippet of current behavior:

presto:default> SELECT try(json_parse(x)), TRY_CAST(TRY("json_parse"(x)) AS array(varchar)), ARRAY[X] from (values '[2] [3]', '[3] bad json]', '[4] [bad json') as t(x
);
 _col0 | _col1 |      _col2       
-------+-------+------------------
 [2]   | [2]   | [[2] [3]]        
 NULL  | NULL  | [[3] bad json]]  
 [4]   | [4]   | [[4] [bad json] 
(3 rows)

Possible Solution

Throw on bad json's.

Context

We are currently trying to verify and get Prestissimo behavior similar to Presto behavior and running into verification errors due to this.

@kgpai
Copy link
Contributor Author

kgpai commented Nov 19, 2024

cc: @rschlussel @amitkdutta

@tdcmeehan
Copy link
Contributor

Related: #23806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🆕 Unprioritized
Development

No branches or pull requests

2 participants