fix(snowflake): null-guard getByType and use Objects.equals for incrementValue - #2139
Merged
Merged
Conversation
…mentValue getByType returns null for unrecognized types; the builder dereferenced it in three loops (create columns, indexes, modify columns), NPE-ing. Add if (... == null) continue guards, mirroring every sibling builder. Also, buildAlterTable compared Long incrementValue with !=, which is reference equality and emitted a spurious AUTOINCREMENT= on every alter; use Objects.equals, mirroring MysqlSqlBuilder. Fixes OtterMind#2131 Co-Authored-By: Claude <noreply@anthropic.com>
openai0229
force-pushed
the
fix/2131-snowflake-sqlbuilder
branch
from
July 26, 2026 06:26
5ae1507 to
e52fbb1
Compare
openai0229
approved these changes
Jul 26, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the contribution. I corrected the unsupported-type path so it fails with a descriptive error instead of silently dropping DDL elements, added three regression tests, and verified the Snowflake module on current main. Approved.
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 #2131
Summary
Fixes two correctness issues in
SnowflakeSqlBuilder:Longincrement values are now compared withObjects.equals, preventing a spuriousAUTOINCREMENTalteration caused by reference comparison.IllegalArgumentExceptionthat includes the unsupported type. Silent omission would produce apparently successful but incomplete table DDL.Affected surfaces
Verification
mvn -pl chat2db-community-plugins/chat2db-community-snowflake -am -Dmaven.test.skip=false -DskipTests=false -Dtest=SnowflakeSqlBuilderTest -Dsurefire.failIfNoSpecifiedTests=false test- passed.SnowflakeSqlBuilderTest- 3 tests passed: unknown column type, unknown index type, and equal boxed increment values.getByTypecall sites to confirm that unsupported metadata cannot be silently dropped from CREATE or ALTER output.Risk and compatibility
Reviewer map
SnowflakeSqlBuilder.requireColumnType,requireIndexType, andSnowflakeSqlBuilderTest.AUTOINCREMENT, or unsupported types are omitted without an error.Contributor declaration
AI assistance: The original contribution used Claude Code. A maintainer used Codex to correct the unsupported-metadata behavior and add regression coverage.