[FLINK-40300][python] Fix literal expression in Python Table API - #28924
Open
auroflow wants to merge 5 commits into
Open
[FLINK-40300][python] Fix literal expression in Python Table API#28924auroflow wants to merge 5 commits into
auroflow wants to merge 5 commits into
Conversation
Collaborator
Normalize explicitly typed literal values across Py4J before creating Table API expressions. Generated-by: OpenAI Codex (GPT-5)
Build reusable type-directed converter functions for nested literal values and document the Py4J boundary. Generated-by: OpenAI Codex (GPT-5)
Convert multiset elements recursively on both sides of the Py4J boundary and align the new Java code with project style. Generated-by: OpenAI Codex (GPT-5)
Convert temporal and array values before passing inferred literals through Py4J, while preserving Python array typecodes for Java type inference. Generated-by: OpenAI Codex (GPT-5)
auroflow
force-pushed
the
auroflow/fix-table-api-lit
branch
from
August 6, 2026 07:41
1c23797 to
160530a
Compare
Route Table and DataFrame literals through one Java bridge that preserves Java type inference, validates nested values, and builds plannable composite expressions. Add planning and execution coverage for inferred, explicit, composite, and invalid literals. Generated-by: OpenAI Codex (GPT-5)
auroflow
force-pushed
the
auroflow/fix-table-api-lit
branch
from
August 6, 2026 08:39
160530a to
7256a9c
Compare
auroflow
marked this pull request as ready for review
August 6, 2026 09:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Creating a PyFlink literal with
lit(value)andlit(value, data_type)requires the value to first cross the Py4J boundary and then pass Flink's Java-side literal validation. The current implementation can fail at either stage:datetime.date,datetime.time,datetime.datetime, anddatetime.timedeltaare not supported by the Py4J protocol directly. Therefore, literals declared asDATE,TIME,TIMESTAMP,TIMESTAMP_LTZ, or day-timeINTERVALfail before the Java Table API is invoked.Python numeric values are implicitly converted by Py4J into a limited set of Java boxed classes. A Python
intbecomesIntegerwhen it fits into 32 bits andLongotherwise, while a Pythonfloatalways becomesDouble. Consequently:TINYINTexpectsBytebut receivesInteger;SMALLINTexpectsShortbut receivesInteger;BIGINTexpectsLongbut receivesIntegerfor values within the 32-bit range;FLOATexpectsFloatbut receivesDouble.These values are rejected by
ValueLiteralExpression.validateValueDataType().Without an explicit data type, Python lists and tuples reach Java as generic containers. Java literal inference requires concrete Java arrays to infer the element type, particularly for empty
array.arrayvalues and nested arrays.The same issue affected nested values in arrays, maps, multisets, and rows.
This change converts Python-only values before transport, normalizes boxed numeric values in Java, and creates the literal in the same JVM call so that Py4J cannot convert the normalized value back to a Python primitive. The goal is to align the functionality of PyFlink Table API
litwith Java Table APIlit.Brief change log
ARRAY,MAP, andROWexpressions.Verifying this change
This change added tests and can be verified as follows:
PythonTableUtilsTestcoverage for Py4J numeric representations, year-month intervals, Java array inference, typed nulls, and invalid composite literals.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: OpenAI Codex (GPT-5)