Repository navigation
Fix data-type names containing the substring INT being parsed as MySQL integers - #108354
Conversation
…L integers
ParserDataType treated any data-type name whose uppercase contained the
substring "INT" as a MySQL integer type that accepts a display-width
modifier (e.g. INT(11)). The check used type_name_upper.contains("INT"),
which also matched unrelated names such as quantileInterpolatedWeighted
(contains "INT" inside "INTERPOLATED"), pointInPolygon, intDiv, etc.
For such a name used in a data-type position, the leading (N) group was
consumed as a display width and silently dropped. A parametric form like
quantileInterpolatedWeighted(0.8)(a, 1) lost its (0.8) on formatting and
re-emitted as quantileInterpolatedWeighted(a, 1), so the formatted query
no longer parsed back to the same AST. In debug/sanitizer builds the
executeQuery round-trip check then aborted with the LOGICAL_ERROR
"Inconsistent AST formatting" (the shape-(2) signature of STID 1941-26fa,
seen by the AST/BuzzHouse fuzzers).
Match the integer type names and their MySQL aliases exactly instead of
by substring. The MySQL display-width modifier and SIGNED/UNSIGNED suffix
keep working for the real integer types (TINYINT(8), INT(32), INT(11)
UNSIGNED, ...), and unrelated names no longer have their first argument
group eaten.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gateClick to expand
Session id: cron:clickhouse-worker-slot-0:20260624-064600 |
|
cc @evillique @george-larionov — could you review this? It's a small |
|
Workflow [PR], commit [b898e89] Summary: ❌
AI ReviewSummaryThis PR narrows Final VerdictStatus: ✅ Approve |
…reserved
With the loose contains("INT") substring match, toUInt128 was mistaken for a
MySQL integer type and its (12) group was consumed as a display-width modifier
and silently dropped. The exact-match isIntegerTypeName() predicate no longer
matches toUInt128, so the (12) argument is preserved on round-trip.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Pushed That test round-trips Verified locally on a debug build (Build ID 18df1742): |
CI finish ledger — 7bc9b32Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
The Bad-cast (STID 1499-22cb) and the iceberg write-test timeout are both unrelated to this PR -- it only changes Session id: cron:our-pr-ci-monitor:20260624-203000 |
|
Correction to the CI finish ledger above (SHA So the amd_tsan ledger line resolves to fixing PR #107968 (ours, open), not a flaky iceberg test. No iceberg fix is pending. Session id: cron:clickhouse-worker-slot-0:20260624-205800 |
|
@groeneai I think long term it would be better to not add this new stateless test that only focusses on this now fixed bug but instead expand test coverage of existing tests that focus on these issues. Please consider to
|
Following review feedback on ClickHouse#108354: instead of a dedicated bug-specific test, fold the coverage into the existing tests that already focus on these areas. - 03210_inconsistent_formatting_of_data_types.sh: add the type-position quantileInterpolatedWeighted(0.8)(a, 1) case. This is the parser/formatter round-trip regression home; the case must produce a Syntax error rather than having its leading (N) eaten as a MySQL display width. Verified this case fails on the pre-fix parser and passes with the fix. - 01268_data_numeric_parameters.sql: extend the integer block to every alias that accepts the (N) display-width modifier, bare and with (N): TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT, INT1. - 02271_int_sql_compatibility.sql: extend the SIGNED/UNSIGNED suffix coverage from INT to every whitelist alias (TINYINT/SMALLINT/MEDIUMINT/INTEGER/BIGINT). - Drop the dedicated 04365 test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Agreed, consolidated into the existing tests and dropped the dedicated one (
One note on scope: the whitelist also lists the native forms All three pass 20/20 with randomized settings, and are parallel-safe ( |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 10/10 (100.00%) · Uncovered code |
CI finish ledger — b898e89CI fully finished (Finish Workflow: success). This PR changes only
Session id: cron:our-pr-ci-monitor:20260630-163000 |
Ledger correction (SHA
|
| Check / test | Reason | Owner / fixing PR |
|---|---|---|
| Integration tests (amd_tsan, 6/6) / test_ttl_replicated::test_ttl_drop_parts_limit | Keeper TSAN data race surfaced at module teardown (not a test-body flake) | #107083 (external, open) |
The test itself passed. It is recorded as ERROR at teardown of test_ttl_drop_parts_limit: pytest logged PASSED then ERROR, because the module fixture's cluster.shutdown() scans every container's log for the sanitizer banner (helpers/cluster.py:4254, SANITIZER_SIGN) and raises Sanitizer assert found for instance zoo3-1. The assert is attributed to whichever test ran last in the module, not to a defect in the test.
Root cause (from this run's docker.log, container zoo3-1): WARNING: ThreadSanitizer: data race on a Keeper queue slot, both accesses through KeeperRequestForSession::operator=(&&) (KeeperCommon.h:60):
- Write (TCP handler thread):
NonblockingBoundedQueue::tryPush(NonblockingBoundedQueue.h:107) <-KeeperRequestDispatcher::putRequest(KeeperRequestDispatcher.cpp:309) - Read (dispatch thread):
NonblockingBoundedQueue::tryPop(NonblockingBoundedQueue.h:138) <-KeeperRequestDispatcher::tryPopRequest(KeeperRequestDispatcher.cpp:348) <-dispatchThread()
This is in core Keeper (the NonblockingBoundedQueue Vyukov queue + KeeperRequestDispatcher), not in test_ttl_replicated. The same Sanitizer assert found for instance zoo* signature hits 18 unrelated integration tests across the amd_tsan shards in 30d (e.g. test_storage_s3_queue, test_refreshable_mv, test_drop_replica, test_backup_restore_on_cluster, ...) plus 3 master runs - confirming it is queue-wide, not test-specific.
Fixing PR #107083 ("Suppress TSAN error in NonblockingBoundedQueue", open since 2026-06-10) targets exactly this: it adds NO_SANITIZE_THREAD to tryPush/tryPop, with a comment describing the same slot.value write/read race and concluding it is a TSAN false positive (the acquire/release on slot.pos establishes happens-before; isomorphic to Vyukov's original). It is unmerged, so the failing build (b898e89, no NO_SANITIZE_THREAD) predates it. This PR cannot affect a Keeper TSAN race - it touches only src/Parsers/ParserDataType.cpp + 4 stateless data-type tests.
#107928 (merged 2026-06-19) did speed up the test body; all 6 of the historical 900s query-timeouts on this test predate that merge.
Session id: cron:clickhouse-worker-slot-8:20260630-171500
0bb6576
Following review feedback on ClickHouse#108354: instead of a dedicated bug-specific test, fold the coverage into the existing tests that already focus on these areas. - 03210_inconsistent_formatting_of_data_types.sh: add the type-position quantileInterpolatedWeighted(0.8)(a, 1) case. This is the parser/formatter round-trip regression home; the case must produce a Syntax error rather than having its leading (N) eaten as a MySQL display width. Verified this case fails on the pre-fix parser and passes with the fix. - 01268_data_numeric_parameters.sql: extend the integer block to every alias that accepts the (N) display-width modifier, bare and with (N): TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT, INT1. - 02271_int_sql_compatibility.sql: extend the SIGNED/UNSIGNED suffix coverage from INT to every whitelist alias (TINYINT/SMALLINT/MEDIUMINT/INTEGER/BIGINT). - Drop the dedicated 04365 test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…-int-substring Fix data-type names containing the substring INT being parsed as MySQL integers
Related: #107806
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed parsing of data-type names whose name contains the substring
INT(for example a function-like name such asquantileInterpolatedWeightedused in a data-type position). Such names were mistaken for MySQL integer types and had their first(...)argument group silently consumed as a display-width modifier, which could break the query formatting round-trip.Description
ParserDataTypetreated any data-type name whose uppercase contains the substringINTas a MySQL integer type that accepts a display-width modifier (e.g.INT(11)). The check usedtype_name_upper.contains("INT"), which also matched unrelated names such asquantileInterpolatedWeighted(containsINTinsideINTERPOLATED),pointInPolygon,intDiv, and so on.For such a name used in a data-type position the leading
(N)group was consumed as a display width and silently dropped. A parametric form likequantileInterpolatedWeighted(0.8)(a, 1)lost its(0.8)on formatting and re-emitted asquantileInterpolatedWeighted(a, 1), so the formatted query no longer parsed back to the same AST. In debug and sanitizer builds theexecuteQueryround-trip check then aborted with theLOGICAL_ERROR"Inconsistent AST formatting".This is the parametric-aggregate (shape-2) signature of the AST formatting finding STID 1941-26fa, produced by the AST and BuzzHouse fuzzers. The no-argument-window-function variant of the same STID was fixed separately in #107806.
CI report (Stress test, amd_debug) where the signature was observed: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106522&sha=095d6c6a9efbfb32fbb3233307115a6e42d16755&name_0=PR&name_1=Stress%20test%20%28amd_debug%29
The fix matches the integer type names and their MySQL aliases exactly instead of by substring. The MySQL display-width modifier and the
SIGNED/UNSIGNEDsuffix keep working for the real integer types (TINYINT(8),INT(32),INT(11) UNSIGNED, ...), while unrelated names no longer have their first argument group eaten.Version info
26.7.1.430(included in26.7and later)