Skip to content

[CALCITE-4564] Initialization context for non-static user-defined functions (UDFs)#2395

Closed
julianhyde wants to merge 7 commits intoapache:masterfrom
julianhyde:4564-udf-initializer
Closed

[CALCITE-4564] Initialization context for non-static user-defined functions (UDFs)#2395
julianhyde wants to merge 7 commits intoapache:masterfrom
julianhyde:4564-udf-initializer

Conversation

@julianhyde
Copy link
Contributor

I would appreciate a review, but reviewing the lines of code (which is what GitHub PRs seem to encourage) is the least useful. I would prefer feedback on the specification (how users would use this feature) and design. Therefore please leave comments at https://issues.apache.org/jira/browse/CALCITE-4564; or log JIRA cases for follow-up work.

…ed functions (UDFs)

When Interpreter calls a UDF, invoke its constructor only once.
In InterpreterTest, allow more than one query to be executed per test method.

FunctionContext for user-defined aggregated functions doesn't quite work yet.
julianhyde added a commit to julianhyde/calcite that referenced this pull request Apr 19, 2021
…ctions (UDFs)

When Interpreter or code generated by RexToLixTranslator calls
a UDF, invoke its constructor only once. There will therefore
be one instance of the UDF for the whole execution, and that
instance can be used to store state. Typical state will be
preparation work (e.g. compiling a regular expression) to make
each invocation faster.

Add 'interface FunctionContext' (marked as experimental). If
a UDF has a public constructor with FunctionContext as a
parameter, this will be called in preference to the default
constructor.

In InterpreterTest, allow more than one query to be executed
per test method.

Close apache#2395
julianhyde added a commit to julianhyde/calcite that referenced this pull request Apr 19, 2021
…ctions (UDFs)

When Interpreter or code generated by RexToLixTranslator calls
a UDF, invoke its constructor only once. There will therefore
be one instance of the UDF for the whole execution, and that
instance can be used to store state. Typical state will be
preparation work (e.g. compiling a regular expression) to make
each invocation faster.

Add 'interface FunctionContext' (marked as experimental). If
a UDF has a public constructor with FunctionContext as a
parameter, this will be called in preference to the default
constructor.

In InterpreterTest, allow more than one query to be executed
per test method.

Close apache#2395
@julianhyde
Copy link
Contributor Author

Merged as b2e9e6c.

XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Jul 14, 2021
…ctions (UDFs)

When Interpreter or code generated by RexToLixTranslator calls
a UDF, invoke its constructor only once. There will therefore
be one instance of the UDF for the whole execution, and that
instance can be used to store state. Typical state will be
preparation work (e.g. compiling a regular expression) to make
each invocation faster.

Add 'interface FunctionContext' (marked as experimental). If
a UDF has a public constructor with FunctionContext as a
parameter, this will be called in preference to the default
constructor.

In InterpreterTest, allow more than one query to be executed
per test method.

Close apache#2395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant