v.23.8New Feature
Added array manipulation functions: arrayRotateLeft, arrayRotateRight, arrayShiftLeft, and arrayShiftRight.
(#52755 , #52895) Added functionsarrayRotateLeft,arrayRotateRight,arrayShiftLeft,arrayShiftRight. #53557 (Mikhail Koviazin).
Why it matters
These functions provide efficient ways to rotate or shift elements within an array. They solve the problem of manipulating array element order directly in ClickHouse queries, enabling users to perform cyclic rotations and shifts of array data without external processing or complex expressions.How to use it
Use the new functions in your SQL queries by passing the target array and the number of positions to rotate or shift. For example:SELECT arrayRotateLeft([1, 2, 3, 4, 5], 2);
SELECT arrayShiftRight([1, 2, 3, 4, 5], 1);These functions can be used anywhere arrays are processed inside
SELECT statements or other query contexts.