fdolce opened a new pull request, #30095:
URL: https://github.com/apache/flink/pull/30095
## What is the purpose of the change
Calling `descriptor()`, `json_object()`, `json_array()`, `object_of()` or
`Expression.object_update()` in PyFlink fails with `Py4JException: Method ...
does not exist`. These functions passed their trailing arguments to Java one by
one, but py4j does not pack them into the varargs array of the Java method, so
no signature matches. This pull request passes them as a Java array, so the
functions build the same expressions as their Java counterparts.
## Brief change log
- `descriptor` passes the column names as a `String[]`
- `object_of`, `json_object` and `json_array` pass their trailing
arguments as an `Object[]`, the same way `array` and `coalesce` already do
- `Expression.object_update` passes its key-value pairs as an `Object[]`
- Removed the `_varargs_op` helper from `expressions.py`, which no longer
has callers
Note: the fixed functions build the Java array inline, repeating the same
few lines at each call site, as the other varargs functions in these files
already do (`array`, `coalesce`, `printf`, ...). Moving this into a shared
helper would be better done as a separate hotfix that converts all call sites,
not only the ones touched by this bug.
## Verifying this change
This change added tests and can be verified as follows:
- Added assertions to `test_expression.py` for the five functions,
including calls without trailing arguments and with `None` values. They fail
with the `Py4JException` above without the fix.
## 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 fixed functions are `@PublicEvolving`, but their
signatures are unchanged)
- 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 (claude-fable-5-2)
--
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]