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

Julian Hyde edited comment on CALCITE-6550 at 9/9/24 11:21 PM:
---------------------------------------------------------------

[~njordan],Thanks for raising this. I see you changed the constructor of 
{{SqlBasicFunction}} from {{private}} to {{protected}} in CALCITE-6358 and the 
5 months since then it has been subclassed 12 times, including in CALCITE-6310, 
CALCITE-6449, and CALCITE-6312.

{{SqlBasicFunction}} was not intended to be subclassed.  This is tech debt that 
*must* be fixed before 1.38.


was (Author: julianhyde):
[~njordan],Thanks for raising this. I see you changed the constructor of 
{{SqlBasicFunction}} from {{private}} to {{protected}} in CALCITE-6358 and the 
5 months since then it has been subclassed 12 times. This is tech debt that 
must be fixed before 1.38.

> Improve SQL function overloading
> --------------------------------
>
>                 Key: CALCITE-6550
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6550
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Norman Jordan
>            Assignee: Norman Jordan
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.38.0
>
>
> All SQL functions across all SQL libraries as well as the standard functions 
> are used as keys in a Map (in the class {*}RexImpTable{*}). The hashcode and 
> equals methods currently only look at the name, kind and class.
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/SqlOperator.java#L424]
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/SqlOperator.java#L439]
> This causes a few problems:
>  * Some functions may have the same name and kind but different sets of 
> parameters
>  * Two different SQL libraries may have functions with the same name and kind 
> (and even parameters) but have different implementations.
> The current work around is to create new anonymous classes when needed to 
> avoid collisions in the Map. Here is an example.
> https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L578
> The hashcode and equals methods should consider more information, such as the 
> parameters as well as some way to differentiate similar functions in 
> different libraries.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to