XuQianJin-Stars opened a new pull request #1067: [CALCITE-2864]Add the 
JSON_DEPTH function
URL: https://github.com/apache/calcite/pull/1067
 
 
   Returns the maximum depth of a JSON document. Returns NULL if the argument 
is NULL. An error occurs if the argument is not a valid JSON document.
   
   An empty array, empty object, or scalar value has depth 1. A nonempty array 
containing only elements of depth 1 or nonempty object containing only member 
values of depth 1 has depth 2. Otherwise, a JSON document has depth greater 
than 2.
   
   Example Sql:
   
   ```sql
   SELECT JSON_DEPTH(v) AS c1
   ,JSON_DEPTH(JSON_VALUE(v, 'lax $.b' ERROR ON ERROR)) AS c2
   ,JSON_DEPTH(JSON_VALUE(v, 'strict $.a[0]' ERROR ON ERROR)) AS c3
   ,JSON_DEPTH(JSON_VALUE(v, 'strict $.a[1]' ERROR ON ERROR)) AS c4
   FROM (VALUES ('{"a": [10, true],"b": "[10, true]"}')) AS t(v)
   limit 10;
   ```
   
   Result:
   
   | c1   | c2   | c3   | c4   |
   | ---- | ---- | ---- | ---- |
   | 3    | 2    | 1    | 1    |
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to