numericIndexedVectorAllValueSum
Introduced in: v25.7.0
Returns the sum of all values in the numericIndexedVector.
Syntax
numericIndexedVectorAllValueSum(v)Arguments
Returned value
Returns the sum. Float64
Examples
Usage example
SELECT numericIndexedVectorAllValueSum(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res;┌─res─┐
│ 60 │
└─────┘numericIndexedVectorBuild
Introduced in: v25.7.0
Creates a NumericIndexedVector from a map. The map’s keys represent the vector’s index and map’s value represents the vector’s value.
Syntax
numericIndexedVectorBuild(map)Arguments
map— A mapping from index to value.Map
Returned value
Returns a NumericIndexedVector object. AggregateFunction
Examples
Usage example
-- A NumericIndexedVector is a binary value, so it is shown with `hex`.
SELECT
hex(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res,
toTypeName(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS type;┌─res────────────────────────────────────────────────────────────────┬─type───────────────────────────────────────────────────────┐
│ 080000000000000001010000020103000002020300000201030000020203010101 │ AggregateFunction(groupNumericIndexedVector, UInt8, UInt8) │
└────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────┘numericIndexedVectorCardinality
Introduced in: v25.7.0
Returns the cardinality (number of unique indexes) of the numericIndexedVector.
Syntax
numericIndexedVectorCardinality(v)Arguments
Returned value
Returns the number of unique indexes. UInt64
Examples
Usage example
SELECT numericIndexedVectorCardinality(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res;┌─res─┐
│ 3 │
└─────┘numericIndexedVectorGetValue
Introduced in: v25.7.0
Retrieves the value corresponding to a specified index from a numericIndexedVector.
Syntax
numericIndexedVectorGetValue(v, i)Arguments
v—numericIndexedVectori— The index for which the value is to be retrieved.(U)Int*
Returned value
A numeric value with the same type as the value type of NumericIndexedVector. (U)Int* or Float*
Examples
Usage example
SELECT numericIndexedVectorGetValue(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30])), 3) AS res;┌─res─┐
│ 30 │
└─────┘numericIndexedVectorPointwiseAdd
Introduced in: v25.7.0
Performs pointwise addition between a numericIndexedVector and either another numericIndexedVector or a numeric constant.
Syntax
numericIndexedVectorPointwiseAdd(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
WITH
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toInt32(x), [10, 20, 30]))) AS vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toInt32(x), [10, 20, 30]))) AS vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseAdd(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseAdd(vec1, 2)) AS res2;┌─res1──────────────────┬─res2─────────────┐
│ {1:10,2:30,3:50,4:30} │ {1:12,2:22,3:32} │
└───────────────────────┴──────────────────┘numericIndexedVectorPointwiseDivide
Introduced in: v25.7.0
Performs pointwise division between a numericIndexedVector and either another numericIndexedVector or a numeric constant.
Syntax
numericIndexedVectorPointwiseDivide(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseDivide(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseDivide(vec1, 2)) AS res2;┌─res1────────────────┬─res2────────────┐
│ {1:0,2:2,3:1.5,4:0} │ {1:5,2:10,3:15} │
└─────────────────────┴─────────────────┘numericIndexedVectorPointwiseEqual
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the values are equal, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseEqual(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 20, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseEqual(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseEqual(vec1, 20)) AS res2;┌─res1──┬─res2──┐
│ {2:1} │ {2:1} │
└───────┴───────┘numericIndexedVectorPointwiseGreater
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the first vector’s value is greater than the second vector’s value, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseGreater(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 50]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 40, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseGreater(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseGreater(vec1, 20)) AS res2;┌─res1──────┬─res2──┐
│ {1:1,3:1} │ {3:1} │
└───────────┴───────┘numericIndexedVectorPointwiseGreaterEqual
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the first vector’s value is greater than or equal to the second vector’s value, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseGreaterEqual(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 50]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 40, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseGreaterEqual(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseGreaterEqual(vec1, 20)) AS res2;┌─res1──────────┬─res2──────┐
│ {1:1,2:1,3:1} │ {2:1,3:1} │
└───────────────┴───────────┘numericIndexedVectorPointwiseLess
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the first vector’s value is less than the second vector’s value, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseLess(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 40, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseLess(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseLess(vec1, 20)) AS res2;┌─res1──────┬─res2──┐
│ {3:1,4:1} │ {1:1} │
└───────────┴───────┘numericIndexedVectorPointwiseLessEqual
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the first vector’s value is less than or equal to the second vector’s value, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseLessEqual(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 40, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseLessEqual(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseLessEqual(vec1, 20)) AS res2;┌─res1──────────┬─res2──────┐
│ {2:1,3:1,4:1} │ {1:1,2:1} │
└───────────────┴───────────┘numericIndexedVectorPointwiseMultiply
Introduced in: v25.7.0
Performs pointwise multiplication between a numericIndexedVector and either another numericIndexedVector or a numeric constant.
Syntax
numericIndexedVectorPointwiseMultiply(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toInt32(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toInt32(x), [10, 20, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseMultiply(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseMultiply(vec1, 2)) AS res2;┌─res1──────────────────┬─res2─────────────┐
│ {1:0,2:200,3:600,4:0} │ {1:20,2:40,3:60} │
└───────────────────────┴──────────────────┘numericIndexedVectorPointwiseNotEqual
Introduced in: v25.7.0
Performs pointwise comparison between a numericIndexedVector and either another numericIndexedVector or a numeric constant. The result is a numericIndexedVector containing the indices where the values are not equal, with all corresponding values set to 1.
Syntax
numericIndexedVectorPointwiseNotEqual(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
with
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toFloat64(x), [10, 20, 30]))) as vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toFloat64(x), [20, 20, 30]))) as vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseNotEqual(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseNotEqual(vec1, 20)) AS res2;┌─res1──────────┬─res2──────┐
│ {1:1,3:1,4:1} │ {1:1,3:1} │
└───────────────┴───────────┘numericIndexedVectorPointwiseSubtract
Introduced in: v25.7.0
Performs pointwise subtraction between a numericIndexedVector and either another numericIndexedVector or a numeric constant.
Syntax
numericIndexedVectorPointwiseSubtract(v1, v2)Arguments
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returned value
Returns a new numericIndexedVector object. numericIndexedVector
Examples
Usage example
WITH
numericIndexedVectorBuild(mapFromArrays([1, 2, 3], arrayMap(x -> toInt32(x), [10, 20, 30]))) AS vec1,
numericIndexedVectorBuild(mapFromArrays([2, 3, 4], arrayMap(x -> toInt32(x), [10, 20, 30]))) AS vec2
SELECT
numericIndexedVectorToMap(numericIndexedVectorPointwiseSubtract(vec1, vec2)) AS res1,
numericIndexedVectorToMap(numericIndexedVectorPointwiseSubtract(vec1, 2)) AS res2;┌─res1───────────────────┬─res2────────────┐
│ {1:10,2:10,3:10,4:-30} │ {1:8,2:18,3:28} │
└────────────────────────┴─────────────────┘numericIndexedVectorShortDebugString
Introduced in: v25.7.0
Returns internal information of the numericIndexedVector in JSON format. This function is primarily used for debugging purposes.
Syntax
numericIndexedVectorShortDebugString(v)Arguments
Returned value
Returns a JSON string containing debug information. String
Examples
Usage example
SELECT numericIndexedVectorShortDebugString(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res FORMAT Vertical;Row 1:
──────
res: {"vector_type":"BSI","index_type":"char8_t","value_type":"char8_t","integer_bit_num":8,"fraction_bit_num":0,"zero_indexes_info":{"cardinality":0},"non_zero_indexes_info":{"total_cardinality":3,"all_value_sum":60,"number_of_bitmaps":8,"bitmap_info":{"cardinality":{"0":0,"1":2,"2":2,"3":2,"4":2,"5":0,"6":0,"7":0}}}}numericIndexedVectorToMap
Introduced in: v25.7.0
Converts a numericIndexedVector to a map.
Syntax
numericIndexedVectorToMap(v)Arguments
Returned value
Returns a map with index-value pairs. Map
Examples
Usage example
SELECT numericIndexedVectorToMap(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res;┌─res──────────────┐
│ {1:10,2:20,3:30} │
└──────────────────┘