You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Will Yu (Jira)" <ji...@apache.org> on 2020/11/20 18:02:00 UTC

[jira] [Comment Edited] (CALCITE-4410) Expose the type of internal sql node in Planner

    [ https://issues.apache.org/jira/browse/CALCITE-4410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17236343#comment-17236343 ] 

Will Yu edited comment on CALCITE-4410 at 11/20/20, 6:01 PM:
-------------------------------------------------------------

[~zabetak]

??Are you proposing to add a new method in the Planner interface???
 Yes

??The main goal of the Planner interface is to be simple and cover the most common needs of the clients. From my perspective also the existing Planner#validateAndGetType does not fit very well in this interface so I am not sure if it was a good idea to add in the first place. Worth noting that in our current codebase the method is not called by anyone.??
 That makes sense.

??Can you share a bit more about your use-case to see what you would like to achieve???
 Sure. In our project, we allow users to provide metadata using SQL, which will be processed in realtime. We need to make sure the types of these SQLs to be number. And if we ingest data using these SQLs, we also need to automatically convert them to be DOUBLE IF some column is, e.g. BIGINT.

I could think of other alternatives:
 1. Only add this method to PlannerImpl. Since it's a impl and the impact should be much smaller. And to add some convenient method in implementation should look ok. We could expose validator in PlannerImpl.
 2. Reuse CalciteCatalogReader, and make CalciteSqlValidator public.

Let me know if you have better ideas. Thanks!


was (Author: my7ym):
[~zabetak] 

??Are you proposing to add a new method in the Planner interface???
Yes

??The main goal of the Planner interface is to be simple and cover the most common needs of the clients. From my perspective also the existing Planner#validateAndGetType does not fit very well in this interface so I am not sure if it was a good idea to add in the first place. Worth noting that in our current codebase the method is not called by anyone.??
That makes sense.

??Can you share a bit more about your use-case to see what you would like to achieve? ??
Sure. In our project, we allow users to provide metadata using SQL, which will be processed in realtime. We need to make sure the types of these SQLs to be number. And if we ingest data using these SQLs, we also need to automatically convert them to be DOUBLE IF some column is, e.g. BIGINT. 

I could think of other alternatives:
1. Only add this method to PlannerImpl. Since it's a impl and the impact should be much smaller. And to add some convenient method in implementation should look ok. We could expose validator in PlannerImpl.
2. Reuse CalciteCatalogReader, and make CalciteSqlValidator public. 

Let me know if you have better ideas. Thanks!

> Expose the type of internal sql node in Planner
> -----------------------------------------------
>
>                 Key: CALCITE-4410
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4410
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Will Yu
>            Assignee: Will Yu
>            Priority: Minor
>
> Currently in Planner interface, there is only possible to fetch the *RelDataType* of the whole SqlNode through *validateAndGetType*, but really hard to fetch the type of one component in the SqlNode, e.g. one of the statement in the select list.
> Currently, we worked it around by duplicate some code in Calcite, which is not a good practice. It would be helpful to directly expose the *SqlValidator::getValidatedNodeType* through Planner.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)