[
https://issues.apache.org/jira/browse/CALCITE-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16770973#comment-16770973
]
Hongze Zhang commented on CALCITE-2791:
---------------------------------------
[~x1q1j1]
Sorry for the late response ,and I see you have added some examples[1] to the
PR, thanks for that!
But unfortunately I think the jsonpath expressions your have wrote in that
place may confuse users. Because the syntax[2] in Parser.jj about JSON_TYPE
shows it does not support jsonpath as input.
I suggest to just put a SQL and output into document, as [~julianhyde] has
addressed.
Also, I suggest to add a test case to JdbcTest[3] using the same SQL.
[1]
[https://github.com/apache/calcite/pull/1013/files#diff-14da5286483b04656df7f6030f926b32R2008]
[2]
[https://github.com/apache/calcite/pull/1013/files#diff-3969d844f7ecd2b3d324bf8b0e5a1e9aR5259|https://github.com/apache/calcite/pull/1013/files#diff-3969d844f7ecd2b3d324bf8b0e5a1e9aR5259]
[3]
https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/test/JdbcTest.java
> Add the JSON_TYPE function
> --------------------------
>
> Key: CALCITE-2791
> URL: https://issues.apache.org/jira/browse/CALCITE-2791
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Forward Xu
> Assignee: Julian Hyde
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> The data in json can be =, <, <=, >, >=, <>,! =, and <=>. But the data types
> in json can be diverse, so when you compare different types, you have a
> priority, and the high priority is greater than the low priority (you can
> view the types with the JSON_TYPE() function). The priorities are as follows:
> BOOLEAN,ARRAY,OBJECT,STRING,INTEGE,DOUBLE,NULL
> Example Data:
> {"a":[10,true]}
> SELECT JSON_TYPE(v) AS c1,
> JSON_TYPE(v.a) AS c2,
> JSON_TYPE(v.a[0]) AS c3,
> JSON_TYPE(v.a[1]) AS c4
> FROM VALUES ('
> {"a": [10, true]}
> ') AS t(v);
> c1 c2 c3 c4
> ======= ======= ======= =======
> OBJECT ARRAY INTEGER BOOLEAN
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)