[FLINK-39201] Skip null values during length enforcement#27730
Merged
fapaul merged 1 commit intoapache:masterfrom Mar 3, 2026
Merged
[FLINK-39201] Skip null values during length enforcement#27730fapaul merged 1 commit intoapache:masterfrom
fapaul merged 1 commit intoapache:masterfrom
Conversation
Collaborator
gustavodemorais
approved these changes
Mar 3, 2026
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
CharLengthConstraint.enforce()andBinaryLengthConstraint.enforce()crash with aNullPointerExceptionwhen a nullableCHAR/VARCHAR/BINARY/VARBINARYcolumncontains a null value. The root cause is that both methods access the field value (e.g.
rowData.getString(idx).numChars()/rowData.getBinary(idx).length) withoutfirst checking
rowData.isNullAt(idx). TheNotNullConstraintonly guardsNOT NULLcolumns, so nullable columns with length constraints are unprotected.Brief change log
to verify null values in nullable columns pass through correctly with
TRIM_PADenforcementVerifying this change
This change added tests and can be verified as follows:
with
TRIM_PADenforcement enabled, verifying that null fields pass through unchanged while non-null fields are correctly trimmed/padded- Added
BINARY_LENGTH_TRIM_PAD_WITH_NULLABLE_COLUMNSsemantic test program that feeds rows with null values into nullableBINARY(8)/BINARY(6)/VARBINARY(6)columns with
TRIM_PADenforcement enabled, verifying the same behavior for binary typesDoes this pull request potentially affect one of the following parts:
call which is negligible)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
Documentation