Repository navigation
Add test: try-deserialize path (Variant/Dynamic) for unquoted DateTime/DateTime64 numbers — raw-value branch untested - #112869
Conversation
|
Pre-PR Validation Gate (per ClickGap pipeline): a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
Workflow [PR], commit [0ace06f] Summary: ✅ AI ReviewSummaryThis PR adds a new stateless regression test for the Findings
Final VerdictChanges required before merge: the added test is a meaningful |
These enable_keeper_conc*/small_remote_buf_user.xml files were accidentally swept into the commit; they are unrelated to the datetime Variant try-deserialize test and belong to test_keeper_snapshot_chunked_transfer. Requested by @PedroTadim in ClickHouse#112869 (comment)
| @@ -0,0 +1,17 @@ | |||
| -- Test the try-deserialization path (Variant column) for an unquoted DateTime/DateTime64 number, | |||
There was a problem hiding this comment.
This only exercises Variant, but the PR still advertises the Variant/Dynamic gap as closed. Dynamic does not reuse SerializationVariant::tryDeserializeImpl here: SerializationDynamic::deserializeText{JSON,Quoted} first infers a type from the raw field and then adds/chooses a dynamic variant, so a bare number goes down a different carrier entirely. If the intent is really to cover Dynamic too, this still needs a dedicated Dynamic(max_types=...) case; otherwise the PR title/description should be narrowed to Variant.
There was a problem hiding this comment.
Verified against the source — you're right, a Dynamic case would not cover this branch.
SerializationDynamic::deserializeText{JSON,Quoted} both funnel into deserializeTextImpl, which reads the raw field and calls tryInferDataTypeByEscapingRule first (SerializationDynamic.cpp:884-888). A bare number like 1703363853.035 infers to a complete numeric type, so the try-into-existing-variants loop (:896-907) — the only place SerializationDateTime64::tryDeserializeText{JSON,Quoted} would run — is skipped, and the value lands as a numeric variant via addNewVariant. Only Variant routes a bare number through those try* readers.
So narrowing to Variant is the correct call. The test is already Variant-only, so no test change is needed.
The title/body still overclaim by mentioning Dynamic. Suggested edits:
- Title:
Add test: try-deserialize path (Variant) for unquoted DateTime/DateTime64 numbers — raw-value branch untested - Body: drop
Dynamicfrom theVariant/Dynamicmentions and add a scope note thatDynamicinfers a complete numeric type from the raw field first (SerializationDynamic.cpp:884-888) and never reachesSerializationDateTime64::tryDeserializeText{JSON,Quoted}, so aDynamiccase would not exercise the raw-value branch.
ClickGapAI · Confidence: HIGH
The bare integer 1703363853 printed 2023-12-23 20:37:33 in both the number and raw-value branches, so the old line passed even if the setting stopped affecting Variant(DateTime). Switch to 1703363853.7, which the raw-value branch rejects (falls back to String). Requested by @clickhouse-gh[bot] in ClickHouse#112869 (comment)
Head branch was pushed to by a user without write access
Change line 11 input from 1703363853 to 1703363853.7 so the Quoted try-path returns DateTime under seconds mode but falls back to String under raw-value mode; reference output (2023-12-23 20:37:33) unchanged. Requested by @clickhouse-gh[bot] in ClickHouse#112869 (comment)
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.
This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.
Adds test coverage for 1 untested code path(s), found during automated review of PR #108091.
That PR The PR changes how an unquoted number is parsed into
DateTime/DateTime64columns in theJSON,Values/Quotedrow-input paths and inJSONExtract/typedJSON(DOM path). An unquoted number is now a Unix timestamp in seconds (with optional sub-second precision) via new `readDateTimeAsNumber1. try-deserialize path (Variant/Dynamic) for unquoted
DateTime/DateTime64numbers — raw-value branch untestedsrc/DataTypes/Serializations/SerializationDateTime64.cpp:236,src/DataTypes/Serializations/SerializationDateTime64.cpp:188Risk: Variant/Dynamic column deserialization calls the
try*readers (SerializationNullable/Variant route non-null values throughtryDeserializeTextJSON), while the PR's tests drive the throwing readers via plain columns and cover the try-path only for one defaultVariant(String, DateTime64(3))case (04492:53). Risk: if the raw-value try-branch is refactored to fall through to the seconds branch, aVariant/DynamicDateTime64value read in compatibility mode …What's unique vs PR tests: The PR's tests drive the THROWING deserialize path via plain
DateTime/DateTime64columns and cover the try-path only for a single defaultVariant(String, DateTime64(3))case (04492:53). No committed test combines theinput_format_read_datetime_number_as_raw_valuecompatibility setting with aVariant/Dynamiccolumn (verified: 0 files contain both), so the raw-value branch oftryDeserializeText{JSON,Quoted}and the defaultDateTimenumber try-branch are never exercised.Try it on ClickHouse Fiddle
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — test-only change.
Documentation entry for user-facing changes
Version info
26.8.1.631(included in26.8and later)