Repository navigation
Support Nullable(Array) - #104816
Support Nullable(Array)#104816zhanglistar wants to merge 106 commits into
Conversation
|
Hi @zhanglistar! Thank you for creating this PR. Unfortunately, proper support for 1) MergeTree serialization stream name collisions The stream names for substreams in MergeTree are generated by For a column Now consider 2) Function execution framework assumptions In 3) Pervasive There are 70+ files that check
All these places require consideration, especially in terms of compatibility. 4) 200+ direct Across 5) At 6) Aggregate functions Aggregate functions like 7) Format compatibility While the PR updates Arrow/ORC/Parquet readers, other formats (JSON, CSV, TSV, etc.) and their schema inference logic ( Given the scope and the risk of subtle bugs (especially around MergeTree data corruption from stream name collisions), this feature would benefit from an RFC that covers:
We plan to work on this in the core team eventually, but it currently doesn't have a set timeline. We appreciate the interest and effort — this is a real and frequently requested feature, and the exploration in this PR is useful context for when we take it on. |
|
Thank you! This is a great PR, and it will greatly improve ClickHouse interoperability!
For
It will be controlled with a compatibility setting. Under the old compatibility, functions that return an Array and might want to make it Nullable, will still use the old path in the code, returning non-Nullable Array.
Implement and see what will break and how to proceed further. Implementation is cheap.
This is ok, most functions will work through defaultImplementationForNullable.
Ok, we will have to do it.
Skip nulls as every aggregate function does by default.
With a compatibility setting. |
|
Workflow [PR], commit [4287142] Summary: ❌
|
|
Recently, we introduced |
|
@alexey-milovidov Thanks for your reply, let me have a try @Avogar. Anyway it's a try whether it will be merged or not. I'll try my best to do it. |
b85b25e to
ccceb4a
Compare
…red substream names and cache keys. Assign unique structured stream suffixes at every array nesting level, and use the same keys in SubstreamsCache during deserialization to avoid colliding outer and inner null maps.
Respect allow_experimental_nullable_array_type when wrapping array-valued subcolumns extracted through an outer Nullable column. This keeps Nullable(JSON) array paths compatible when random settings disable the experimental Nullable(Array) type. CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=7944b5d0e40cace70422529447e1699f14b8167a&name_0=PR&name_1=Stateless+tests+%28arm_binary%2C+parallel%29&name_2=Tests PR: ClickHouse#104816
Allow array element-level tuple arithmetic to run when a nullable scalar denominator has an all-zero replicated null map. This prevents from falling through to the generic element executor and raising . CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=0ec4da2f1a92f1ca4fdd4c05effec4f50a04a1ec&name_0=PR&name_1=Unit%20tests%20%28asan_ubsan%2C%20function_prop_fuzzer%29 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=0ec4da2f1a92f1ca4fdd4c05effec4f50a04a1ec&name_0=PR&name_1=Unit%20tests%20%28msan%2C%20function_prop_fuzzer%29 PR: ClickHouse#104816
Old analyzer can keep casts as Const(Nullable(Array(...))). Several nullable-array helper paths only detected ColumnConst through checkAndGetColumnConst<ColumnConst>, so they missed the outer constant wrapper and passed Const(Nullable(Array(...))) into array execution paths that expect ColumnArray. Use checkAndGetColumn<ColumnConst> before inspecting the data column so mapped array functions, arrayFold, arrayReduce, and array arithmetic unwrap const Nullable(Array) arguments consistently. Related: ClickHouse#104816 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=930b8941d0bff0f02fd904a96f6a30bd16120b53&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20WasmEdge%2C%20parallel%2C%201%2F3%29
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 3212/3670 (87.52%) · Uncovered code |
Move allow_experimental_nullable_array_type to the 26.8 settings history block so upgrade checks from 26.7 see it. Preserve nullable-array missing/default handling in external format readers and extracted subcolumns. Narrow the upgrade log allow-list for the system.metric_log_0 readonly warning and adjust focused stateless coverage. Related: ClickHouse#104816 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=263d7f95798980e19f9c5ccc5cbe7093c36ae78d&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=263d7f95798980e19f9c5ccc5cbe7093c36ae78d&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29
Keep allow_experimental_nullable_array_type and join_runtime_filter_min_probe_rows in the 26.8 settings history block after merging the current PR head. Related: ClickHouse#104816 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104816&sha=263d7f95798980e19f9c5ccc5cbe7093c36ae78d&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29
|
@alexey-milovidov @Avogar Almost make all CI success, pls take a look if you have time. |
# Conflicts: # src/DataTypes/DataTypeNullable.cpp # src/DataTypes/Serializations/ISerialization.cpp # src/Interpreters/InterpreterCreateQuery.cpp # src/Interpreters/InterpreterCreateQuery.h # src/Processors/Formats/Impl/ORCBlockInputFormat.cpp
|
🕵 Status check against current 1. The three open AI-review threads are already addressed at your current head — I re-verified each against
These threads can be resolved. 2. The PR is
3. CI is stale. The last reports are for
Merging |
|
🕵 Follow-up to my status check yesterday — two corrections/updates after a deeper pass over head 1. The Arrow IPC re-port I flagged is in fact already done at your head.
2. The five newer AI-review threads (07-21/07-22) are also all addressed at your current head — I verified each against
The exact reviewed scenario ( What actually remains is just the |
|
🕵 CI has now run on your current head
The fast-test build is compiled without Arrow/Parquet/ORC, so any test using -- Tags: no-fasttestEverything else in that report is green (12820 tests, 1 failure). Two remaining items from my earlier passes, unchanged:
All 8 open I cannot push these for you: maintainer edits are disabled on the |
|
🕵 Assessment of the current stateI went through this PR at head Short version: all seven blockers from that review are substantively addressed. This is no longer an exploratory patch. What remains is largely about evidence and reviewability rather than missing functionality. The design decision that answers most of the list
This is exactly what the RFC promised, and I think it is the right call. It answers blocker 3 ("70+ files check The cost is the mirror image. Blocker-by-blocker
Where the RFC has drifted from the implementation@Avogar asked for an RFC, and #105192 is now stale in five places. Each is a decision this PR made but did not write back:
Specific findings1. 2. Each is a candidate for a silently wrong answer rather than an exception, so they are worth classifying explicitly even where the conclusion is "unreachable". 3. The dual naming dispatch is the sharpest edge in the PR, and it is not in the RFC. This is not hypothetical. Rebasing onto current 4. 5. Minor: in On the rebaseThe PR is currently
@zhanglistar — thank you for the sustained work here; the test suite in particular is substantial. Maintainer edits appear to be disabled on the |
|
🕵 Proposed plan to move forwardFollowing on from the assessment above. The functionality is essentially there; what is missing is the evidence needed to approve a change that alters an on-disk format. The steps below are ordered so that the irreversible decisions get scrutiny before merge and the reversible ones can follow. Step 1 — Get the branch back onto
|
|
🕵 Rebase validated, plus one confirmed defectFollow-up to the two comments above, now that the rebase onto current Validation status
A sixth merge site that
|
|
🕵 Superseded by #115165. I could not push the conflict resolution to the external fork because maintainer edits are disabled; the new PR preserves the original implementation and credits @zhanglistar. Thank you for the contribution. |
|
🕵 Superseded by #115165. I could not push the conflict resolution to the external fork because maintainer edits are disabled; the new PR preserves the original implementation and credits @zhanglistar. Thank you for the contribution. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
#105192
Add support for Nullable(Array). Set allow_experimental_nullable_array_type = 1 to enable it.