Skip NULL elements in text index over Array(LowCardinality(Nullable))#110055
Conversation
The array branch of MergeTreeIndexAggregatorText::update checked IColumn::isNullable(), which returns false for LowCardinality(Nullable), so getDataAt() was called on a NULL array element and threw NOT_IMPLEMENTED (Code 48). This broke INSERT, MATERIALIZE INDEX and merge/OPTIMIZE index rebuilds (wedging the table's merges), while the scalar branch and Array(Nullable) already handled NULLs correctly. Use isColumnNullableOrLowCardinalityNullable() to detect nullability, matching the scalar branch, so NULL elements are skipped during index construction. Closes ClickHouse#110039 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-6:20260710-210200 |
|
cc @CurtizJ @rschu1ze @ahmadov for review — one-line fix in the text-index aggregator's array branch (use |
…ex-array-lc-nullable # Conflicts: # src/Storages/MergeTree/MergeTreeIndexText.cpp
|
Workflow [PR], commit [9ff7d35] Summary: ✅
AI ReviewSummaryThis PR fixes Final Verdict
|
…le)) The postprocessor path of the text index (update() -> tokenizeToArray when postprocessor->hasActions()) detected element nullability with IColumn::isNullable(), which returns false for ColumnLowCardinality(Nullable). So getDataAt() was called on a NULL array element and threw NOT_IMPLEMENTED, failing INSERT / MATERIALIZE INDEX / merge for a text index with a postprocessor over Array(LowCardinality(Nullable(String))). Use isColumnNullableOrLowCardinalityNullable, matching the MergeTreeIndexText.cpp array branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Done — pushed 9ff7d35. Switched the I grepped the array-element path repo-wide ( Regression: extended Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-2:20260711-122100 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 9/9 (100.00%) · Uncovered code |
CI finish ledger — 9ff7d35All checks green (153 success / 18 skipped, Finish Workflow + Mergeable Check pass). No failed checks to attribute.
Session id: cron:our-pr-ci-monitor:20260711-173000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
NOT_IMPLEMENTEDerror (Method getDataAt is not supported for Nullable(String) in case if value is NULL) when atextindex is built onArray(LowCardinality(Nullable(String)))(includingNestedfields stored that way) and an indexed array contains aNULLelement.NULLarray elements are now skipped during index construction, matchingArray(Nullable(String)).Description
Closes: #110039
The array branch of
MergeTreeIndexAggregatorText::updatedetected element nullability withIColumn::isNullable(), which returnsfalseforColumnLowCardinality(Nullable). As a resultgetDataAt()was called on aNULLarray element and threwCode: 48 NOT_IMPLEMENTED. This failed the INSERT, and when data already existed it left a permanently retryingMATERIALIZE INDEXmutation and wedged merges/OPTIMIZE(which rebuild the index) until the index was dropped.Array(Nullable(String))and scalarLowCardinality(Nullable(String))were unaffected; the scalar branch already usesisColumnNullableOrLowCardinalityNullable(). The fix uses the same helper in the array branch soNULLLowCardinality(Nullable)elements are skipped, on INSERT,MATERIALIZE INDEX, and merge/OPTIMIZErebuilds alike.Regression test
04401_text_index_array_lowcardinality_nullablecovers both fiddle cases from the issue (the directArray(LowCardinality(Nullable(String)))andNestedforms) plus theMATERIALIZE INDEXandOPTIMIZE FINALmerge-rebuild paths.Version info
26.7.1.813(included in26.7and later)