fix(clickhouse): null-guard index type enum in buildCreateTable - #2154
fix(clickhouse): null-guard index type enum in buildCreateTable#2154Aias00 wants to merge 1 commit into
Conversation
|
The null guard prevents the immediate NPE, but this PR is not ready to merge because it silently drops an index from the generated ClickHouse DDL when Please define the intended policy for an unknown index type: either fail with a descriptive error or log/handle the omission explicitly. Add automated generated-DDL tests for known, primary, null, and unknown index mappings, asserting the complete output. This builder also overlaps the open #2174 changes, so please rebase onto the latest |
openai0229
left a comment
There was a problem hiding this comment.
The null guard still silently omits unknown indexes from generated DDL, which can hide schema loss, and the required DDL policy tests are missing. The current head does not address the detailed review comment already posted, so this remains blocked pending an updated commit and re-review.
getByType returns null for unrecognized types; !PRIMARY.equals(null) is true so null.buildIndexScript() NPEs. Add if (== null) continue with a log.warn so unknown index types are visible in logs instead of silently dropped. Add 4 generated-DDL tests covering known, primary, null, and unknown index-type mappings. Fixes OtterMind#2148 Co-Authored-By: Claude <noreply@anthropic.com>
cf50229 to
3cbdd62
Compare
|
Rebased onto latest main. Unknown index types now log.warn instead of silent skip. 4 generated-DDL tests added: known, primary, null, unknown. Tests run: 4, Failures: 0. |
Related issue
Closes #2148
Summary
ClickHouseSqlBuilder.buildCreateTable called getByType then checked !PRIMARY.equals(result) — if result was null, !PRIMARY.equals(null) is true, so null.buildIndexScript() NPEs. Added if (mysqlIndexTypeEnum == null) continue; mirroring every sibling builder.
Verification
Contributor declaration
AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.