Repository navigation
[CALCITE-6437]For druid sql JSON_OBJECT() function results in RUNTIME_FAILURE when querying INFORMATION_SCHEMA.COLUMNS - #3821
AlbericByte wants to merge 3 commits into
Conversation
|
@AlbericByte Please create a new issue in JIRA. |
add the jira in the description : CALCITE-6437 |
|
In order to make it easier to keep track of the correspondence of issues in JIRA and github the issue title should match exactly the JIRA title. |
|
Please add a unit test that fails before the fix. |
Got it, thanks for the tips |
|
mihaibudiu
left a comment
There was a problem hiding this comment.
Besides the comment I left, this looks fine
| (6 rows) | ||
|
|
||
| !ok | ||
| !ok2 |
There was a problem hiding this comment.
this change looks strange
|
|
||
| !ok | ||
|
|
||
| # Test cases for [CALCITE-6437] For druid sql JSON_OBJECT() function results in RUNTIME_FAILURE when querying |
There was a problem hiding this comment.
This SQL can run success without this PR. And according to this change, I doubt this is a good way to fix this issue in Calcite.
|
the issue arises from the fact that Druid tries to implement Comparing against So I think another way to solve this is to introduce |
|
|
|
@NobiGo @kgyrtkirk @mihaibudiu in Druid the return type of json_object function is ExpressionType.NESTED_DATA, but in Calcite, the return type of json_object is VARCHAR(2000). From current calcite logic, if can not find the sqlfunction in RexImpTable, calcite will throw exception. And actually in druid, we have implement json_object in JsonObjectExprMacro. is there any api to register new SqlJsonObjectFunction with NESTED_DATA in druid? so i can register a new SqlJsonObjectFunction with NESTED_DATA output. i tried to reused SqlStdOperatorTable.JSON_OBJECT in druid, and also add cast or json_query to wrap the json_object, but it will fail because the SqlStdOperatorTable.JSON_OBJECT return varchar, or cast donot support NESTED_DATA. seems i can not find better solution outside calcite, could you please give me a guidance. Thanks |
|
What is the status of this PR? Is it ready or more work is needed? |
|
There are many functions in Calcite which are "overloaded", which behave differently depending on the SQL dialect. You can define a new function, with the same name, but a different implementation for Druid. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |



Fix the druid json_object issue.
Description
jira: CALCITE-6437
druid issue: apache/druid#16356
We can overwrite to be SqlJsonObjectFunction
add one more construction of SqlJsonObjectFunction as following
and update JsonObjectOperatorConversion in druid as following: