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

Caican Cai commented on CALCITE-6550:
-------------------------------------

There is another issue to consider here. If the SqlStdOperatorTable is already 
being adapted, then SqlLibraryOperators does not seem to take effect.

> 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
>
> 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