Mr-LiuXu opened a new pull request, #5673:
URL: https://github.com/apache/hive/pull/5673

   **Fixed the error in parsing the element of the array when the path of the 
array is not specified in the json data using the **get_json_object** 
function.**
   
   For example:
   json='{"respBody":{"data":[{"score":60},{"score":90}]}}'
   The first scenario:
   **get_json_object**(json,'$.respBody.data[0].score')
   The return result is: 60, which is correct;
   The second scenario:
   **get_json_object**(json,'$.respBody.data.score[0]')
   The return result is also: 60, which is incorrect; RespBody.data is an array 
below, but it does not specify which element to retrieve from the data array. 
Instead, it specifies the first element of the array after the score. In this 
case, a specific value should not be returned as it can cause ambiguity. 
According to strict mode, it should be returned as null.
   ### Suggested solution:
   The **get_json_object** (json, path, [**arrayStrictMode**]) function adds an 
optional field, **arrayStrictMode**, which is not passed in and defaults to 
false, following the previous pattern parsing; If true, follow strict mode. If 
the json array does not specify which element to retrieve, return empty.
   For example:
   **get_json_object**(json,'$.respBody.data.score[0]',true)  
   The return result is: null。
   When **get_json_object**(json,'$.respBody.data[0].score', true)
   The return result is: 60.


-- 
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: gitbox-unsubscr...@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to