[
https://issues.apache.org/jira/browse/PHOENIX-3355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15602492#comment-15602492
]
Maryann Xue commented on PHOENIX-3355:
--------------------------------------
Thank you, [~lomoree]! They are good questions.
1. Yes, the "views" map gets cleared at the start of each statement, to ensure
that there's no additional caching. We should always rely on Phoenix's existing
caching in MetaDataClient, but the "tables" and "views" maps in PhoenixSchema
are for secondary index registration in calcite. We only register secondary
indexes that could potentially be used in a certain query. So instead of using
the "views" map for built-in functions, you should have another independent
map. It would be even better if you could make it static.
2. The default parameter mechanism is supported by Calcite already. Take a look
at PhoenixScalarFunction.java, which is used to convert a Phoenix's PFunction
into a Calcite's ScalarFunction. I think [~rajeshbabu] has been trying to
figure things out for default values, but maybe you can take a look here too.
Changes are required in this class I think.
3. Similar to (2), you can derive the return type from input parameter types
(as [~jamestaylor] said), so you can think of how to adjust implementation for
PhoenixScalarFunction.getReturnType(RelDataTypeFactory).
> 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)