Skip to content

[FLINK-39122][table] Reject out-of-range decimal constant arguments#28437

Open
rionmonster wants to merge 1 commit into
apache:masterfrom
rionmonster:flink39122
Open

[FLINK-39122][table] Reject out-of-range decimal constant arguments#28437
rionmonster wants to merge 1 commit into
apache:masterfrom
rionmonster:flink39122

Conversation

@rionmonster

@rionmonster rionmonster commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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

Generative AI

  • Was generative AI tooling used to co-author this PR? yes (Claude Code via Opus 4.8)

Reviewer(s) Requested

@twalthr (original reporter)

@flinkbot

flinkbot commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants