[
https://issues.apache.org/jira/browse/CALCITE-3382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16951281#comment-16951281
]
Rui Wang edited comment on CALCITE-3382 at 10/14/19 9:04 PM:
-------------------------------------------------------------
Thanks Julian. I am trying to build table function TUMBLE on top of this JIRA
and found that function overloading problem is not fully solved.
To conclude a bit: The problem happens in validator. Because for old TUMBLE,
we will still return "TUMBLE" when getName() is called, it will still go to the
function overloading case in SqlFunction.deriveType. In SqlFunction.dervieType,
even though the operator in GROUP clause is recognized, it will still try to
lookup operator by name. And to remind, SqlFunction.deriveType is not favor of
function overloading, thus it still lead to a cannot match/match a wrong
operator case.
So until now I am thinking two ways to solve it:
option one: override SqlFunction.dervieType in SqlGroupedWindowFunction so it
skip the operator lookup for the old TUMBLE operator.
option two: Make old TUMBLE return "$TUMBLE".
The option two is more like a breaking change and I am leaning to option one.
What do you think?
Basically option one above will need to skip this line:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/SqlFunction.java#L239
was (Author: amaliujia):
Thanks Julian. I am trying to build table function TUMBLE on top of this JIRA
and found that function overloading problem is not fully solved.
To conclude a bit: The problem happens in validator. Because for old TUMBLE,
we will still return "TUMBLE" when getName() is called, it will still go to the
function overloading case in SqlFunction.deriveType. In SqlFunction.dervieType,
even though the operator in GROUP clause is recognized, it will still try to
lookup operator by name. And to remind, SqlFunction.deriveType is not favor of
function overloading, thus it still lead to a cannot match/match a wrong
operator case.
So until now I am thinking two ways to solve it:
option one: override SqlFunction.dervieType in SqlGroupedWindowFunction so it
skip the operator lookup for the old TUMBLE operator.
option two: Make old TUMBLE return "$TUMBLE".
The option two is more like a breaking change and I am leaning to option one.
What do you think?
> Rename current TUMBLE to "$TUMBLE" and add TUMBLE to Parser
> -----------------------------------------------------------
>
> Key: CALCITE-3382
> URL: https://issues.apache.org/jira/browse/CALCITE-3382
> Project: Calcite
> Issue Type: Sub-task
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.22.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> Per discussion in https://github.com/apache/calcite/pull/1457, we should add
> TUMBLE to parser and rename it to "$TUMBLE".
> "TUMBLE" as an operator name will be left for table-value function TUMBLE.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)