[ https://issues.apache.org/jira/browse/CALCITE-2864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16780075#comment-16780075 ]
Hongze Zhang commented on CALCITE-2864: --------------------------------------- [~x1q1j1], [~michaelmior], sorry for re-pinging you. The fix seems to introduce a tiny unused test-generated file [https://github.com/apache/calcite/blob/master/core/custom-schema-model.json], It is not a big deal and I am going to remove it with a follow-up commit, please let me know if the file is still useful. > Add the JSON_DEPTH function > --------------------------- > > Key: CALCITE-2864 > URL: https://issues.apache.org/jira/browse/CALCITE-2864 > Project: Calcite > Issue Type: Sub-task > Reporter: Forward Xu > Assignee: Forward Xu > Priority: Major > Labels: pull-request-available > Fix For: 1.19.0 > > Time Spent: 50m > Remaining Estimate: 0h > > 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: > 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 message was sent by Atlassian JIRA (v7.6.3#76005)