Repository navigation
[Spark] Check for null arguments in CDC read - #4489
Merged
Merged
Conversation
1 of 5 tasks
OussamaSaoudi
pushed a commit
that referenced
this pull request
Sep 26, 2025
#### Which Delta project/connector is this regarding? - [x] Spark - [ ] Standalone - [ ] Flink - [ ] Kernel - [ ] Other (fill in here) ## Description The previous fix for `NullPointerException` in #4489 wasn't enough to catch all cases: `table_changes('tableName', CAST(null AS INT))` would still result in NPE. This PR fixes it by wrapping the code in try-catch, and rethrowing correct error on NPE. ## How was this patch tested? New unit test with casted null. ## Does this PR introduce _any_ user-facing changes? No
huashi-st
pushed a commit
to huashi-st/delta
that referenced
this pull request
Apr 24, 2026
#### Which Delta project/connector is this regarding? - [x] Spark - [ ] Standalone - [ ] Flink - [ ] Kernel - [ ] Other (fill in here) ## Description The previous fix for `NullPointerException` in delta-io#4489 wasn't enough to catch all cases: `table_changes('tableName', CAST(null AS INT))` would still result in NPE. This PR fixes it by wrapping the code in try-catch, and rethrowing correct error on NPE. ## How was this patch tested? New unit test with casted null. ## Does this PR introduce _any_ user-facing changes? No
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.
Which Delta project/connector is this regarding?
Description
CDC read query
table_changesdoes not supportnullvalue as the start or end parameter. However, passingnullargument via the SQL API results in NullPointerException. This PR adds a check fornullargument and throws a DeltaIllegalArgumentException with the new error classDELTA_CDC_READ_NULL_RANGE_BOUNDARYfor the SQL API.Similarly, providing
nullversion for Scala API resulted in NumberFormatException. Added a new error classDELTA_VERSION_INVALIDfor this purpose (similar to existingDELTA_TIMESTAMP_INVALIDfor null timestamps).How was this patch tested?
New unit tests are added in DeltaCDCScalaSuite and DeltaCDCSQLSuite to test for cases when either the start or the end parameter is
null. Tests expect a proper DeltaIllegalArgumentException (SQL) or DeltaAnalysisException (Scala) to be thrown, which was not the case before.Other unit tests are added to DeltaErrorsSuite to test if the error messages are correctly reported for the new error classes.
Does this PR introduce any user-facing changes?
No