Repository navigation
Add function arrayTranspose - #101214
Add function arrayTranspose#101214
Conversation
|
Workflow [PR], commit [8fdbaac] Summary: ✅ AI ReviewSummaryThis PR adds a new SQL function Findings
Tests
ClickHouse Rules
Final Verdict
|
There was a problem hiding this comment.
Pull request overview
Adds a new ClickHouse array function arrayTranspose to transpose 2D arrays (matrices), along with stateless tests and expected outputs.
Changes:
- Implemented
arrayTransposeas a newIFunctionthat validates rectangular inner arrays per row and transposes them. - Added stateless SQL queries covering typical, edge, nullable, and error cases.
- Added reference output for the new stateless test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Functions/array/arrayTranspose.cpp |
Implements and registers the arrayTranspose function with validation and documentation. |
tests/queries/0_stateless/04068_arrayTranspose.sql |
Adds coverage for normal matrices, degenerate/empty matrices, nullable elements, multi-row inputs, and expected errors. |
tests/queries/0_stateless/04068_arrayTranspose.reference |
Adds expected outputs matching the new stateless test queries. |
|
The closest existing alternative is New function |
|
Maybe it makes sense to implement the cache oblivious version of the matrix transpose algorithm? |
7ebd760 to
7c03be9
Compare
I implemented this. For POD types now it uses the cache oblivious algorithm, for complicated types the generic algorithm is still used. I looked at arrayReverse (which also moves elements of array) and used a similar approach. |
7c03be9 to
434b16e
Compare
|
Clang tidy failure fixed here: #101524 |
a46ba22 to
a08dddf
Compare
|
Flaky test 03668_shard_join_in_reverse_order is being fixed in #101654 |
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
alexey-milovidov
left a comment
There was a problem hiding this comment.
@vitlibar, please link PRs for fixing the TSan failure and fixing the logical error.
|
The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158 |
LLVM Coverage Report
Changed lines: 95.18% (296/311) · Uncovered code |
done |
|
Neat, thank you! |
07668f7
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add new function
arrayTransposetaking a two-dimensional array (matrix) and transposing it:Version info
26.4.1.767