[
https://issues.apache.org/jira/browse/CALCITE-4410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17237026#comment-17237026
]
Julian Hyde edited comment on CALCITE-4410 at 11/22/20, 9:39 PM:
-----------------------------------------------------------------
I share [~zabetak]'s concern that we would add many methods to {{Planner}} and
the lifecycle would become less clear. But I agree that it is reasonable to get
the type of a {{SqlNode}}.
I guess we could add a {{SqlValidator getValidator()}} method to {{Planner}};
it would throw if you are at an early phase of planning and there is not yet a
validator.
We could instead add a {{<T> unwrap(Class<T> clazz)}} method to {{Planner}}
(i.e. make {{Planner}} implement {{Wrapper}}) and people could call
{{planner.unwrap(SqlValidator.class)}}.
was (Author: julianhyde):
I share [~zabetak]'s concern that we would add many methods to {{Planner}} and
the lifecycle would become less clear. But I agree that it is reasonable to get
the type of a {{SqlNode}}.
I guess we could add {{SqlValidator getValidator()}} to {{Planner}}; it would
throw if you are at an early phase of planning and there is not yet a validator.
We could instead add {{<T> unwrap(Class<T> clazz)}} to {{Planner}}, and people
could call {{planner.unwrap(SqlValidator.class)}}.
> 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)