[
https://issues.apache.org/jira/browse/CALCITE-7772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ruben Q L resolved CALCITE-7772.
--------------------------------
Resolution: Fixed
Done in
[{{7953617}}|https://github.com/apache/calcite/commit/795361702d573a31efffd6edbf23d23b5bb70de2]
> ModelHandler.addFunctions should defer UDF class initialization until after
> shape validation
> --------------------------------------------------------------------------------------------
>
> Key: CALCITE-7772
> URL: https://issues.apache.org/jira/browse/CALCITE-7772
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> {{ModelHandler.addFunctions(...)}} currently loads the UDF class (already
> controlled by a ClassNameFilter allowlist/denylist) named in the model with
> the single-argument {{Class.forName(className)}}, which uses
> {{initialize=true}}. Only after the class object is returned do the
> shape-check helpers ({{TableFunctionImpl.create}}, {{TableMacroImpl.create}},
> {{ScalarFunctionImpl.create}} / {{functions}},
> {{AggregateFunctionImpl.create}}) decide whether the class is usable as a
> function, and if none of them accepts it, {{addFunctions}} throws {{"Not a
> valid function class: ..."}} at the end of the method. That ordering means
> the class's static initializer runs even when the class turns out to be the
> wrong shape, which can be avoided. This will keep allowlist guarantee at
> "these classes may be used as functions", not "these classes' static
> initializers may be run at will".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)