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

Maryann Xue commented on PHOENIX-3355:
--------------------------------------

I just suggested using a temporary map and iterate the BUILT_IN_FUNCTION_MAP 
just once. The temporary map will be somewhat mapping a function name to all 
its available signatures.
So if we going to register COALESCE as an UDF, we'll have to register all its 
overloads. Another option is to skip registering COALESCE since calcite has 
support for it already. If you take a line 738 of CalciteUtils.java, you can 
see there are a few built-in functions already handled by this translation 
logic {{EXPRESSION_MAP.put(SqlKind.OTHER_FUNCTION, new ExpressionFactory()}}. 
For each of our built-in function that's also supported in Calcite, we'll have 
to decide whether to use the Calcite support or override with our UDF 
registration. Basically we are free to choose, if it IS overridable, and if the 
signatures are identical. But let's just have a static list, say, in 
CalciteUtils, "TRANSLATED_BUILT_IN_FUNCTIONS", so that your UDF registration 
logic can skip them. And maybe you can COALESCE in this list.

> Register Phoenix built-in functions as Calcite functions
> --------------------------------------------------------
>
>                 Key: PHOENIX-3355
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3355
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Eric Lomore
>              Labels: calcite
>         Attachments: PHOENIX-3355.wip
>
>
> We should register all Phoenix built-in functions that don't exist in Calcite.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to