dylanhz opened a new pull request, #29202: URL: https://github.com/apache/flink/pull/29202
## What is the purpose of the change Fix [FLINK-40672](https://issues.apache.org/jira/browse/FLINK-40672): `CAST(PARSE_JSON('null') AS INT)` should return SQL NULL. A non-null VARIANT can contain JSON null, but deriving CAST nullability solely from the source type can produce a non-null result type and cause the cast to fail. ## Brief change log - Apply Calcite's VARIANT nullability rules to Flink's SQL CAST type derivation. - Make Table API casts from VARIANT to other types nullable and use the inferred result type in planner conversion. Preserve VARIANT-to-VARIANT and nested target nullability. - Extend the existing type strategy and CAST integration tests. ## Verifying this change - `TypeStrategiesTest`: 34 tests passed. - `CastFunctionITCase`: 951 tests passed using JUnit and MiniCluster, including SQL, Table API, and Table API-to-SQL serialization. - Spotless and Checkstyle passed for `flink-table-common` and `flink-table-planner`. The full repository `clean verify` suite was not run. ## Does this pull request potentially affect one of the following parts: - Dependencies: no. - The public API: yes; corrects the inferred nullability of CAST results. No API signatures change. - The serializers: no. - The runtime per-record code paths: yes; corrected nullability enables the existing VARIANT-null handling in generated CAST code. - Deployment or recovery: 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: Codex (GPT-6) -- 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]
