Repository navigation
Conversation
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-2:20260708-081900 |
|
cc @Avogar — could you review? Small CSV formats fix: a Tuple serialized into separate columns with a leading NULL element was mistaken for the whole Tuple being NULL under the default null_as_default=1, losing the row. Fix routes separate-column Tuples to SerializationTuple's per-element null_as_default handling. |
|
Workflow [PR], commit [d634bc93] Summary: ❌
AI ReviewSummaryThis PR changes bare Final Verdict✅ No blocking or major issues found. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 12/12 (100.00%) · Uncovered code |
|
Fixed the Fast test failure on The previous gate disabled
The fix distinguishes them by the character right after Verified both directions:
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260708-090500 |
|
Addressed both review comments in 87c97b4. Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-3:20260708-105600 |
CI finish ledger — 5337152All checks passed. No failed checks to attribute.
Session id: cron:our-pr-ci-monitor:20260708-180000 |
|
Round 4 (trailing-column budget) pushed as 035cbc6. Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-0:20260708-180200 |
|
Round 5 pushed as 25ece17. Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-3:20260708-191100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-4:20260708-204000 |
|
@Avogar this PR fixes the #106247 CSV separate-column Tuple leading-NULL data loss, and through several review rounds the field-count budget now handles every decidable case (leading-NULL last column, trailing scalars, trailing non-nullable and nested tuples, For two adjacent separate-column tuples
Same types, same three cells, opposite tilings, and each tiling parses cleanly on its own ( Options:
I lean towards option 1 (minimal, fixes the reported data loss, no over-fitting to the bot's synthetic tail cases), but this is your area. Which would you prefer? |
CI finish ledger — ffb3000Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task. Only
Session id: cron:our-pr-ci-monitor:20260722-043000 |
|
Still needed, and #108959 actually resolves the open design question on this PR. #108959 fixed the So #109744 is still the fix for #106247. It also unblocks the design question I raised in issuecomment-4919745768. The round-7 counterexample ( I will rebase on master and drop the content-aware nullable-tail budget (the rounds 6-8 machinery), leaving just the bare-tuple leading- |
45f12e4 to
caf94f8
Compare
|
Rebased on master (with #108959) and simplified as promised. New head Since #108959 makes a The a-i validation gate is below. Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-author-slot-3:20260723-201501 |
Internal second-model review — adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; multiple rounds across the rebase+simplify). Findings and dispositions:
Severity: ❌ blocker / Session id: cron:clickhouse-author-slot-3:20260723-201501 |
CI finish ledger — caf94f8Every failure below has an owner (a fixing PR). The PR's own new test (04405 CSV Tuple
Session id: cron:our-pr-ci-monitor:20260724-040000 |
|
@groeneai Let's not overcomplicate here. With enabled |
|
Done, simplified to that rule. A non-empty Removed: the field-count budget, the recursive cell-width helper, the trial-parse fallback, and the One behaviour change to flag, since it is the reason the budget existed. A non-empty bare Head is e242fbf. The test fails on master, passes with the fix, and goes red when the condition is reverted; it covers both nullable and non- |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 30/32 (93.75%) · Uncovered code |
Avogar
left a comment
There was a problem hiding this comment.
The code looks weird. I would expect: If column type is Tuple and setting deserialize_separate_columns_into_tuple is enabled, don't use SerializationNullable::deserializeNullAsDefaultOrNestedTextCSV here. Instead, use it in SerializationTuple::deserializeCSV for each element.
CI finish ledger - 283bb1dEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260731-155315 |
|
@groeneai check my review comment |
|
I tried exactly that and it does not work, so here is the measurement rather than an argument. That was the head I pushed for your previous comment ( The blocker is that two inputs are valid CSV for the same bare
The current head therefore applies your rule where it is decidable: for the last file column it reads the elements behind a checkpoint and keeps them only if they end exactly at end of record, otherwise it rolls back and master's path runs unchanged. If you prefer the simple rule and accept the |
|
@groeneai it's ok to change the test if it inserts default on \N for Tuple() with enabled |
With input_format_csv_deserialize_separate_columns_into_tuple = 1 a Tuple is read from one CSV cell per element, so the first cell belongs to the first element. readFieldImpl applied the whole-column input_format_null_as_default short-circuit first, so a leading \N was taken to mean the entire Tuple column was NULL: the row was replaced by a default and the remaining cells were misread as the next column, failing with INCORRECT_DATA "Expected end of line". That is issue ClickHouse#106247. Skip the whole-column branch for a non-empty Tuple whose elements are separated by the field delimiter. SerializationTuple::deserializeTextCSV already applies null_as_default per element, so a null in a non-Nullable element becomes that element's default, which is what it already did for every position other than the first. The elements are separate cells only when tuple_delimiter is the field delimiter. HiveText reuses this reader with its own field delimiter while tuple_delimiter stays a comma, so a tuple is one field there and a null in it is still the whole column. A bare Tuple therefore always occupies one cell per element, so a lone \N in a tuple's cell position is no longer read as the whole column being NULL. 01016_input_null_as_default pinned that older reading through the setting's default value; its CSV rows now spell the tuple's cells out and expect the element defaults. Avogar confirmed the previous expectation was wrong. An empty Tuple() has no elements and a Nullable(Tuple) is read from a single field, so both keep the whole-column behaviour. A null inside a nested Tuple is still read as that whole nested element, unchanged and out of scope.
283bb1d to
d634bc9
Compare
|
Done, pushed as d634bc9. The fix is back to the one condition you asked for:
Two things I found while validating, both fixed here:
A one-element I also documented the restriction on
Validation: |
CI finish ledger - d634bc9Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260808-133000 |
|
Fixing PR for the |
2655f0e
|
Hi @groeneai @Avogar — this PR appears to contain a backward incompatible change but is categorized as Why: With default settings, Suggested category: Could you check if the changelog category should be updated? This helps users know what to expect when upgrading. Ignore this if the change is intentionally non-breaking. |
|
Agreed, and done: I have recategorised this to Measured on official
The third row is the one I think justifies the category on its own, and it is stronger than the case you raised: a one-element One correction to your repro so it reproduces as written: in a SQL string literal The |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reading a CSV bare
Tuplenow takes one field per element in every position, so a\Nin the field of a top-level element is that element andinput_format_null_as_defaultapplies to it. Previously a leading\Nwas taken for the whole column being null, so the row was replaced by the column default and the remaining element cells then failed to parse; that is issue #106247. This is backward incompatible for a row that supplies a single field for a whole bareTuple: it is now short by the remaining elements and is rejected, and for a one-elementTuple, where the field count is the same either way, it silently yields the element default instead of the columnDEFAULT. Setinput_format_csv_deserialize_separate_columns_into_tuple = 0to read such a field as the whole column again.Description
A
Tupleis written to CSV as one cell per element, so(NULL, 1)becomes\N,1. Reading it back,CSVFormatReader::readFieldImplapplied the whole-columninput_format_null_as_defaultshort-circuit first, took the leading\Nfor the whole column being null, inserted the column default, then failed on the element cells that followed. That is issue #106247.The fix skips that short-circuit for a non-empty bare
Tuplesplit on the field delimiter;SerializationTuple::deserializeTextCSValready applies the setting per element. Elements are separate cells only whentuple_delimiteris the field delimiter, soHiveTextstill reads a tuple as one field. An emptyTuple(), aNullable(Tuple)and a null inside a nestedTupleare unchanged.Recategorised from
Bug Fixafter merge, on clickgapai's report below. At default settings a row supplying a single\Nfield for a whole bareTuplepreviously took the columnDEFAULT; a multi-elementTuplenow raisesCANNOT_PARSE_INPUT_ASSERTION_FAILED, and a one-element one, where the field count is the same either way, silently yields the element default instead. Measured on official 26.8.1.1154 against pre-merge master 604017b.01016_input_null_as_defaultpinned the old reading and its CSV rows now spell the cells out; Avogar confirmed that expectation was wrong.Validated by
04405_csv_tuple_leading_null_null_as_defaultand04657_hive_text_tuple_whole_field_null, each failing without its part of the fix.Version info
26.8.1.1110(included in26.8and later)