fix(snowflake): null-safe metadata compare in column-type build - #2001
Merged
Merged
Conversation
buildDataType and buildNullable called .equals() on Integer-typed column metadata (columnSize / decimalDigits / nullable) that can be null when the driver omits it, throwing NullPointerException during MODIFY-column ALTER generation. The null guard on nullable ran after the dereference. Use Objects.equals and the same null-metadata handling as DBStructUtils (OtterMind#1968). Adds a regression test. Fixes OtterMind#1998 Co-Authored-By: Claude <noreply@anthropic.com>
openai0229
approved these changes
Jul 24, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
Reviewed and updated. The null-safe size/scale comparisons are correct. I also tightened the MODIFY nullable path so missing metadata cannot be misinterpreted as a NOT NULL change, and added a regression assertion for the generated SQL. Targeted Snowflake tests pass locally.
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.
Related issue
Closes #1998
Summary
SnowflakeColumnTypeEnum.buildDataTypeandbuildNullablecomparedInteger-typed column metadata (columnSize,decimalDigits,nullable) using.equals(). These fields are boxedIntegerand arenullwhen the driver omits metadata — the same null-metadata scenarioalready handled in
DBStructUtils(#1968) but not applied here.buildDataType(lines 128–129) dereferencedcolumn.getOldColumn().getColumnSize()/getDecimalDigits()→ NPE on MODIFY.buildNullable(line 174) calledcolumn.getNullable().equals(...)before its own
getNullable() != nullguard (line 175) → NPE on MODIFYwhen nullable metadata is missing.
Switched both to
Objects.equals(...), and added a regression test(
SnowflakeColumnTypeEnumTest) that constructs a MODIFY column with nullIntegermetadata on both the current and old column and assertsbuildCreateColumnSqlno longer throws.Affected surfaces
Verification
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0; reactor BUILD SUCCESS.Risk and compatibility
Objects.equalsmatches.equalssemantics for non-null).Reviewer map
SnowflakeColumnTypeEnum.javalines 128–130 and 175 —.equals→Objects.equals; new importjava.util.Objects.Contributor declaration
AI assistance: The fix, test, verification, and PR description were produced with Claude Code assistance.