anupamaggarwal commented on PR #24967:
URL: https://github.com/apache/flink/pull/24967#issuecomment-2219410170

   thanks @snuyanzin for your review!
   I think both these cases are related to inconsistent behavior (IIUC) of `IS 
JSON` function which is used in json_unquote implementation for checking JSON 
validity. I had observed something similar earlier (see `Open questions` 
section of the PR description. 
   
   ```
   SELECT JSON_UNQUOTE('"1""1"');
   ```
   As you pointed out this should ideally throw an exception (as mysql), 
however IS JSON returns true in this case  (IIUC this should be a bug? since 
`1""1` is not a valid json)
   
   ```
   select '"1""1"' is json; //true 
   ```  
   If we fix this by throwing an exception (preferable), it could be 
in-consistent with what IS JSON considers as valid json?
   Should we care about compatibility with IS JSON behavior here (or just fix 
this and file a JIRA for IS JSON?)
   
   Same is the case with 
   ```
   SELECT JSON_UNQUOTE('"1""\uzzzz"')
   select '"1""\uzzzz"' is JSON; //true
   ``` 
   However in this case we throw an exception (from json_unquote) since \uzzzz 
is not a valid literal 
   
   For 
   ```
   SELECT JSON_UNQUOTE('"1\uzzzz"')
   ```
    IS JSON returns FALSE and we return the input string back per 
documentation. 
   
   >SELECT JSON_UNQUOTE('"\"\ufffa"');
   >it starts printing backslash as well which is NOT OK
   
   Hmm, I tested this through the sql-client.sh, and  I get `" ` which seems 
expected? (as "\"\ufffa" is a valid JSON )
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to