twalthr opened a new pull request, #30093:
URL: https://github.com/apache/flink/pull/30093
## What is the purpose of the change
Follow-up to #30019, which added versioning of operators that Calcite
references directly, such as `ITEM`. That PR wraps such an operator with
`BuiltInSqlOperator`, but the result is no `SqlFunction`. A wrapped
`SqlFunction` (e.g. `CURRENT_DATE` or `UPPER`) could then no longer be looked
up with function syntax, because `FlinkSqlOperatorTable` only matches
`SqlFunction`s for it.
This PR allows to version an existing `SqlFunction` the same way, while
keeping it a `SqlFunction`.
## Brief change log
- Add `BuiltInSqlFunction.newBuilder(SqlFunction)`. A `BuiltInSqlFunction`
is now either self-contained (`newBuilder()`) or a versioned copy of an
existing function. The copy has a versioned name such as `$CURRENT_DATE$2`, can
be internal, and delegates to the wrapped function during planning, including
`deriveType`, which would otherwise look up the call by its versioned name.
- `FlinkSqlOperatorTable.VERSIONED_OPERATORS` maps to
`VersionedSqlOperator` instead of `BuiltInSqlOperator`, so the latest version
of a function can be a `BuiltInSqlFunction`. Its JavaDoc describes when to use
which builder.
- `BuiltInSqlOperator.newBuilder(SqlOperator)` rejects a `SqlFunction` and
points to `BuiltInSqlFunction.newBuilder(SqlFunction)`.
## Verifying this change
This change added tests and can be verified as follows:
- `BuiltInSqlFunctionTest` covers a versioned copy (name, version, syntax,
function category, and dynamic function flag of `CURRENT_DATE`), an internal
copy, and that type inference is delegated to the wrapped function.
- The existing restore tests and `RexNodeJsonSerdeTest` pass unchanged;
the plan format does not change since `VERSIONED_OPERATORS` is still empty.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Opus 5.5)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]