[
https://issues.apache.org/jira/browse/CALCITE-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16753160#comment-16753160
]
Hongze Zhang commented on CALCITE-2791:
---------------------------------------
Sorry for the reassignation [~julianhyde], I am not sure why the assignee has
been changed once I click the comment control.
Hi [~x1q1j1], I am not so familiar with the function JSON_TYPE (and also
JSON_LENGTH suggested by the CALCITE-2810), anyway I know a little bit with the
JSON function in Calcite or SQL standard, so maybe I can help provide some
thoughts here.
1. I found some spec definitions from MySQL documentation about the function
[JSON_TYPE|https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-type]
(and
[JSON_LENGTH|https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-length]).
If the functions are not currently introduced by SQL standard and other SQL
implementations, is it worth a discussion about whether to put them to
SqlStdOperatorTable directly? (I personally have no objections – they are MySQL
dialect function, but Calcite does not have a built-in MySQL function table so
far, and there are already some MySQL dialect functions in SqlStdOperatorTable
(e.g. the function TIMESTAMPADD)).
2. MySQL's
[JSON_TYPE|https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-type]
function accepts only a single parameter, but I guess you intend to make it
accept multiple (see
[https://github.com/apache/calcite/pull/1013/files#diff-3969d844f7ecd2b3d324bf8b0e5a1e9aR5259]),
what happens if more than one parameter are passed into the function?
3. MySQL's
[JSON_TYPE|https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html#function_json-type]
function categorizes numeric JSON values with there types: INTEGER, DOUBLE,
and DECIMAL, I see you intend to categorize with INTEGER, LONG, DOUBLE, FLOAT.
Does the types benefit users than just keeping up with MySQL?
> 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: xuqianjin
> Assignee: Julian Hyde
> Priority: Major
> Labels: https://github.com/apache/calcite/pull/1013
>
> 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
> INTEGER
> LONG
> DOUBLE
> NULL
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)