rionmonster opened a new pull request, #28437:
URL: https://github.com/apache/flink/pull/28437
## What is the purpose of the change
This pull request addresses FLINK-39122 which is related to invalid
precision for decimals resulting unexpected in null values. A constant decimal
argument that does not fit the declared type (e.g., `123.456` for a `DECIMAL(2,
2)` parameter) silently produced `NULL` instead of raising a type error. The
literal is implicitly castable on the type level but overflows on the value
level, so it was previous reduced to `NULL` during constant folding. These
changes introduce validation for constant arguments during type inference so
the call fails with a `ValidationException` instead of producing silent null
values.
## Brief change log
- Validate that a constant literal argument fits its expected `DECIMAL`
type in `TypeInferenceUtil`, throwing a `ValidationException` on overflow.
- Add unit, plan, and execution tests for the overflow error and for valid
(fitting) decimal constants.
## Verifying this change
This change added tests and can be verified as follows:
- `InputTypeStrategiesTest` — overflow raises an error; fitting/rounding
constants are accepted.
- `ProcessTableFunctionTest` — the Table API (`fromCall`) and SQL paths
both raise the error.
- `ProcessTableFunctionSemanticTests` — a fitting decimal constant flows
through end-to-end.
## 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: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
## Reviewer(s) Requested
@twalthr (original reporter)
--
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]