Calculates the cross product of two three-dimensional numeric arrays.
For lhs = [x1, x2, x3] and rhs = [y1, y2, y3], the result is:
lhs x rhs = [x2 * y3 - x3 * y2, x3 * y1 - x1 * y3, x1 * y2 - x2 * y1]
cross_productarray_cross_product(ARRAY<T> lhs, ARRAY<T> rhs)
| Parameter | Description |
|---|---|
lhs | The first three-dimensional numeric array |
rhs | The second three-dimensional numeric array |
T supports FLOAT, and integer array element types such as TINYINT, SMALLINT, INT, BIGINT, and LARGEINT.
Returns ARRAY<FLOAT>.
NULL if any input array is NULL.NULL elements.SELECT array_cross_product([2.5, -3.0, 4.25], [-7.5, 0.5, 1.25]);
+--------------------------------------------------------------+ | array_cross_product([2.5, -3.0, 4.25], [-7.5, 0.5, 1.25]) | +--------------------------------------------------------------+ | [-5.875, -35, -21.25] | +--------------------------------------------------------------+
SELECT array_cross_product(CAST([-128, 0, 127] AS ARRAY<TINYINT>), CAST([3, -5, 7] AS ARRAY<TINYINT>));
+---------------------------------------------------------------------------------------------------+ | array_cross_product(CAST([-128, 0, 127] AS ARRAY<TINYINT>), CAST([3, -5, 7] AS ARRAY<TINYINT>)) | +---------------------------------------------------------------------------------------------------+ | [635, 1277, 640] | +---------------------------------------------------------------------------------------------------+
SELECT array_cross_product(CAST(NULL AS ARRAY<FLOAT>), [4.0, 5.0, 6.0]);
+--------------------------------------------------------------------------+ | array_cross_product(CAST(NULL AS ARRAY<FLOAT>), [4.0, 5.0, 6.0]) | +--------------------------------------------------------------------------+ | NULL | +--------------------------------------------------------------------------+
SELECT array_cross_product([-11, NULL, 13], [17, -19, 23]);
ERROR 1105 (HY000): errCode = 2, detailMessage = function array_cross_product cannot have null