zip_with

zip_with

zip_with 介绍

zip_with(left, right, func) - 使用函数将两个给定的数组按元素合并成单个数组。如果一个数组较短,将在应用函数之前,在较短数组的末尾添加null以匹配较长数组的长度。

Examples:

> SELECT zip_with(array(1, 2, 3), array('a', 'b', 'c'), (x, y) -> (y, x));
 [{"y":"a","x":1},{"y":"b","x":2},{"y":"c","x":3}]
> SELECT zip_with(array(1, 2), array(3, 4), (x, y) -> x + y);
 [4,6]
> SELECT zip_with(array('a', 'b', 'c'), array('d', 'e', 'f'), (x, y) -> concat(x, y));
 ["ad","be","cf"]

Since: 2.4.0