Skip to content

Do not accept trailing garbage for CSV-deserialized Time64 values - #102596

Merged
yariks5s merged 3 commits into
masterfrom
yarik/fix-time64-serialization
Apr 27, 2026
Merged

yariks5s merged 3 commits into
masterfrom
yarik/fix-time64-serialization

Conversation

@yariks5s

@yariks5s yariks5s commented Apr 13, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Now we do not accept garbage at the end of Time64 CSV values with input_format_csv_use_default_on_bad_values=0. Closes #102490

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.1.128

@clickhouse-gh

clickhouse-gh Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4c0fe0c]

Summary: ❌

job_name test_name status info comment
Performance Comparison (arm_release, master_head, 3/6) FAIL
Check Results FAIL
Performance Comparison (arm_release, master_head, 5/6) FAIL
Check Results FAIL

AI Review

Summary

This PR tightens Time64 CSV parsing by rejecting trailing garbage in the unquoted path and adds stateless tests for valid and invalid inputs. I did not find correctness, safety, concurrency, or performance blockers in the changed logic. I found one minor typo/grammar issue in a test comment.

Findings

💡 Nits

  • [tests/queries/0_stateless/04099_time64_csv_trailing_garbage.sql:4] Typo/grammar in comment: deserialization reject → deserialization rejects.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Fix the typo/grammar in tests/queries/0_stateless/04099_time64_csv_trailing_garbage.sql line 4.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 13, 2026
@ahmadov ahmadov self-assigned this Apr 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.60% 76.50% -0.10%

Changed lines: 100.00% (10/10) · Uncovered code

Full report · Diff report

@yariks5s
yariks5s enabled auto-merge April 27, 2026 05:45
@yariks5s
yariks5s added this pull request to the merge queue Apr 27, 2026
Merged via the queue into master with commit b7478d4 Apr 27, 2026
158 of 161 checks passed
@yariks5s
yariks5s deleted the yarik/fix-time64-serialization branch April 27, 2026 06:01
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 27, 2026
leshikus added a commit to leshikus/ClickHouse that referenced this pull request Apr 27, 2026
…-serialization`

PR ClickHouse#102596 (`yarik/fix-time64-serialization`) added a trailing-garbage
check in `deserializeTextCSV`: after parsing the unquoted field as a
time string, it now throws `UNEXPECTED_DATA_AFTER_PARSED_VALUE` if the
buffer is not fully consumed.

The test was using `45045123` as an unquoted CSV value. `readTime64Text`
parsed only `45` (SS format) and left `045123` as "trailing garbage",
causing the test to fail across all stateless-test configurations.

Fix: replace the raw integer with `12:30:45.123`, a proper unquoted time
string, and rename the section header accordingly. The expected output
(`00:00:00.000` / `12:30:45.123`) is unchanged since the quoted-CSV and
unquoted time-string paths both normalise correctly.

Ref: ClickHouse#103307

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
pull Bot pushed a commit to AnotherGenZ/ClickHouse that referenced this pull request Apr 27, 2026
leshikus added a commit to leshikus/ClickHouse that referenced this pull request May 2, 2026
commit 600be4aa8a8613d0a4ba9b7e8ad846f789dc93ba
Merge: febefb0 4e4a4c0
Author: Alexei Fedotov <[email protected]>
Date:   Sat May 2 13:48:18 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit febefb0
Author: Alexei Fedotov <[email protected]>
Date:   Fri May 1 01:13:37 2026 +0200

    Remove unimplemented `job_filter_bypass_labels` field from `Workflow.Config`

    The field was declared but never consumed by the job filtering logic in
    `native_jobs.py`, so `"ci-all-jobs"` label would have had no effect.
    Also reverts the `BUILD_TOOLCHAIN (amd64)` timeout override that was
    included in the same commit by mistake.

commit bca4a1f
Merge: fa4ec08 a0aae2a
Author: Alexei Fedotov <[email protected]>
Date:   Fri May 1 01:03:46 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit fa4ec08
Merge: 062b466 d3573bd
Author: Alexei Fedotov <[email protected]>
Date:   Tue Apr 28 07:59:44 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 062b466
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 15:12:22 2026 +0200

    Revert "Address review: keep release-PR guard unconditional when `ci-all-jobs` label is set"

    This reverts commit e9f8a95.

commit e9f8a95
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 15:07:34 2026 +0200

    Address review: keep release-PR guard unconditional when `ci-all-jobs` label is set

    Add `job_filter_bypass_exclude_labels` to `Workflow.Config`. When any of those
    labels are present, `job_filter_bypass_labels` is ignored so `workflow_filter_hooks`
    and file-based job filtering both run normally.

    Configure `pull_request.py` with `job_filter_bypass_exclude_labels=["release",
    "release-lts"]` so a PR carrying both `ci-all-jobs` and a release label still has
    every job skipped by the `should_skip_job` release guard, consistent with the PR
    description ("Release labels still take priority").

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit c07de66
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 13:09:24 2026 +0200

    Fix `04122_serialization_time64_formats` test after `yarik/fix-time64-serialization`

    PR ClickHouse#102596 (`yarik/fix-time64-serialization`) added a trailing-garbage
    check in `deserializeTextCSV`: after parsing the unquoted field as a
    time string, it now throws `UNEXPECTED_DATA_AFTER_PARSED_VALUE` if the
    buffer is not fully consumed.

    The test was using `45045123` as an unquoted CSV value. `readTime64Text`
    parsed only `45` (SS format) and left `045123` as "trailing garbage",
    causing the test to fail across all stateless-test configurations.

    Fix: replace the raw integer with `12:30:45.123`, a proper unquoted time
    string, and rename the section header accordingly. The expected output
    (`00:00:00.000` / `12:30:45.123`) is unchanged since the quoted-CSV and
    unquoted time-string paths both normalise correctly.

    Ref: ClickHouse#103307

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 0ebb9c7
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 13:09:14 2026 +0200

    Move `ci-all-jobs` bypass out of filter hooks into the call site

    `job_filter_bypass_labels` was only checked in the file-based filtering
    phase of `_config_workflow`, so `workflow_filter_hooks` (e.g.
    `private_job_filter`) still ran and skipped jobs even when the
    `ci-all-jobs` label was set.

    Fix: check `job_filter_bypass_labels` before iterating
    `workflow_filter_hooks` in `native_jobs.py` so the bypass is applied
    uniformly to all hook-based filtering, not just file-based filtering.

    The now-redundant early-return for `Labels.CI_ALL_JOBS` inside
    `should_skip_job` is removed — it is dead code once the call site
    handles the bypass.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit dc35478
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 08:54:44 2026 +0200

    Fix race condition and error masking in `test_accept_invalid_certificate`

    `execute_query_native` wrote all test configurations to the same
    `configs/client.xml` path, causing parallel test invocations to
    clobber each other's config and produce inconsistent TLS behaviour.
    Additionally, calling `remove()` inside the `except` block could raise
    `FileNotFoundError`, which replaced the real SSL exception and broke
    the `assert "certificate verify failed"` checks.

    Fix: write each config to a unique temp file via `tempfile.mkstemp` and
    clean it up in a `finally` block that swallows `FileNotFoundError`.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 263d43a
Merge: 5176553 c37e307
Author: Alexei Fedotov <[email protected]>
Date:   Mon Apr 27 08:50:41 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 5176553
Author: Alexei Fedotov <[email protected]>
Date:   Sun Apr 26 09:48:31 2026 +0200

    CI: fix `LLVM Profile Warning: Running out of static counters` in PGO build

    The Stage 1 instrumented clang was compiled with the default value-profiling
    counter limit of 3 slots per indirect call site. During ClickHouse profile
    collection, the instrumented binary emitted:

      LLVM Profile Warning: Unable to track new values: Running out of static
      counters.  Consider using option -mllvm -vp-counters-per-site=<n> to
      allocate more value profile counters at compile time

    This saturates call-site counters and loses indirect-call frequency data
    needed by the PGO optimizer in Stage 2, reducing the quality of the final
    toolchain.

    Fix: pass `-mllvm -vp-counters-per-site=8` via `CMAKE_C_FLAGS` /
    `CMAKE_CXX_FLAGS` when building Stage 1. The flag is baked into the
    instrumented binary at compile time, so the running binary can track up to
    8 distinct callees per indirect call site instead of 3.

    Seen in: ClickHouse#103307

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 22a4eb5
Author: Alexei Fedotov <[email protected]>
Date:   Sun Apr 26 00:17:19 2026 +0200

    Update workflows

commit e281776
Merge: 807b47f 7fc29dc
Author: Alexei Fedotov <[email protected]>
Date:   Sun Apr 26 00:16:47 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 807b47f
Author: Alexei Fedotov <[email protected]>
Date:   Sun Apr 26 00:08:57 2026 +0200

    CI: increase `Build Toolchain (PGO, BOLT) (amd64)` timeout to 8 h on PR

    3 h was too tight; raise to 8 h to match the previous default.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit eb73037
Author: Alexei Fedotov <[email protected]>
Date:   Sat Apr 25 10:55:39 2026 +0200

    Update workflows

commit 30ba815
Merge: 8154744 04bd709
Author: Alexei Fedotov <[email protected]>
Date:   Sat Apr 25 10:54:58 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 8154744
Author: Alexei Fedotov <[email protected]>
Date:   Sat Apr 25 10:22:14 2026 +0200

    CI: fix flaky check assertion and toolchain timeout on PR

    - In `integration_test_job.py`, fall back to a sanity test when `is_flaky_check` is True, no changed integration test modules are found, and `ci-all-jobs` label is set (which bypasses job skips and would otherwise hit the assertion)
    - In `pull_request.py`, override timeout to 3 hours for `Build Toolchain (PGO, BOLT) (amd64)` in the PR workflow

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 040de15
Author: Alexei Fedotov <[email protected]>
Date:   Fri Apr 24 19:51:10 2026 +0200

    CI: fix `_log_fd` leak in `ClickHouseService` when `Popen` raises

    Use a `with` block so the log file descriptor is always closed after
    `subprocess.Popen` returns, whether it raises or not. The child process
    holds its own dup'd fd, so closing Python's copy is safe. Removes the
    now-unnecessary `_log_fd` instance variable and its associated
    `flush`/`close` calls.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 1eeef90
Author: Alexei Fedotov <[email protected]>
Date:   Fri Apr 24 19:38:55 2026 +0200

    CI: add `ci-all-jobs` label to bypass all job skips

    Add a new `ci-all-jobs` PR label that disables both filter-hook skips
    and file-based job filtering, so every job in the workflow runs
    regardless of changed files or other label-based conditions. Release
    labels still take priority.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit f265406
Author: Alexei Fedotov <[email protected]>
Date:   Fri Apr 24 19:25:35 2026 +0200

    Restore --init

commit 72fda4b
Merge: 7fcb083 cf81ad1
Author: Alexei Fedotov <[email protected]>
Date:   Fri Apr 24 19:24:06 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 7fcb083
Author: Alexei Fedotov <[email protected]>
Date:   Wed Apr 22 22:05:03 2026 +0200

    ci: resolve merge conflict in `ci_tests_job.py`

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

commit 5cac837
Merge: 8d8f5a1 3f97d3d
Author: Alexei Fedotov <[email protected]>
Date:   Wed Apr 22 12:07:22 2026 +0200

    Merge branch 'master' into add-ci-tests-init

commit 8d8f5a1
Author: Alexei Fedotov <[email protected]>
Date:   Tue Apr 21 23:42:06 2026 +0200

    CI: fix perf-test SIGTERM by using start_new_session=True, restore --init

    The performance test driver was being killed by its own `SIGTERM` because
    `Utils.terminate_process_group` called `os.killpg(os.getpgid(child_pid), SIGTERM)`,
    but the child server inherited the driver's own process group (since `subprocess.Popen`
    was called with `shell=True` and no session isolation).  With `--init` injecting
    `tini` as PID 1 the driver was no longer immune to `SIGTERM`, so the bogus
    `killpg` killed it — producing "Job killed, exit code [143]".

    Root-cause fix: add `start_new_session=True` to both `Popen` calls in
    `ci/jobs/performance_tests.py` (`start_preconfig` and `start`).  This gives
    the server its own process group, so `os.killpg` can only reach server
    processes and the driver is safe.

    With the real fix in place:
    - `--init` is restored in `ci/praktika/runner.py` (it provides correct zombie
      reaping and was correct to add in ClickHouse#102529).
    - The temporary `--skip test_cleanup_kills_orphaned_test_process` workaround
      is removed from the `CI Tests` job config; the test can now run normally.

    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SerializationTime64::deserializeTextCSV missing !buf.eof() check silently accepts trailing garbage in unquoted CSV fields

3 participants