NumericIndexedVector

## numericIndexedVectorAllValueSum[​](#numericIndexedVectorAllValueSum "Direct link to numericIndexedVectorAllValueSum")

Introduced in: v25.7.0

Returns the sum of all values in the numericIndexedVector.

**Syntax**

```
numericIndexedVectorAllValueSum(v)
```

**Arguments**

- `v` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**Returned value**

Returns the sum. [`Float64`](/docs/sql-reference/data-types/float)

**Examples**

**Usage example**

```
SELECT numericIndexedVectorAllValueSum(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res;
```

```
┌─res─┐
│  60 │
└─────┘
```

## numericIndexedVectorBuild[​](#numericIndexedVectorBuild "Direct link to 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`](/docs/sql-reference/data-types/map)

**Returned value**

Returns a NumericIndexedVector object. [`AggregateFunction`](/docs/sql-reference/data-types/aggregatefunction)

**Examples**

**Usage example**

```
SELECT numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30])) AS res, toTypeName(res);
```

```
┌─res─┬─toTypeName(res)────────────────────────────────────────────┐
│     │ AggregateFunction(groupNumericIndexedVector, UInt8, UInt8) │
└─────┴────────────────────────────────────────────────────────────┘
```

## numericIndexedVectorCardinality[​](#numericIndexedVectorCardinality "Direct link to numericIndexedVectorCardinality")

Introduced in: v25.7.0

Returns the cardinality (number of unique indexes) of the numericIndexedVector.

**Syntax**

```
numericIndexedVectorCardinality(v)
```

**Arguments**

- `v` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**Returned value**

Returns the number of unique indexes. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT numericIndexedVectorCardinality(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30]))) AS res;
```

```
┌─res─┐
│  3  │
└─────┘
```

## numericIndexedVectorGetValue[​](#numericIndexedVectorGetValue "Direct link to numericIndexedVectorGetValue")

Introduced in: v25.7.0

Retrieves the value corresponding to a specified index from a numericIndexedVector.

**Syntax**

```
numericIndexedVectorGetValue(v, i)
```

**Arguments**

- `v` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)
- `i` — The index for which the value is to be retrieved. [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

A numeric value with the same type as the value type of NumericIndexedVector. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Float*`](/docs/sql-reference/data-types/float)

**Examples**

**Usage example**

```
SELECT numericIndexedVectorGetValue(numericIndexedVectorBuild(mapFromArrays([1, 2, 3], [10, 20, 30])), 3) AS res;
```

```
┌─res─┐
│  30 │
└─────┘
```

## numericIndexedVectorPointwiseAdd[​](#numericIndexedVectorPointwiseAdd "Direct link to 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` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)
- `v2` — A numeric constant or numericIndexedVector object. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Float*`](/docs/sql-reference/data-types/float) or [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**Returned value**

Returns a new numericIndexedVector object. [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**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[​](#numericIndexedVectorPointwiseDivide "Direct link to 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` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)
- `v2` — A numeric constant or numericIndexedVector object. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Float*`](/docs/sql-reference/data-types/float) or [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**Returned value**

Returns a new numericIndexedVector object. [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**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────────────┐
│ {2:2,3:1.5} │ {1:5,2:10,3:15} │
└─────────────┴─────────────────┘
```

## numericIndexedVectorPointwiseEqual[​](#numericIndexedVectorPointwiseEqual "Direct link to 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` — [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)
- `v2` — A numeric constant or numericIndexedVector object. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Float*`](/docs/sql-reference/data-types/float) or [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**Returned value**

Returns a new numericIndexedVector object. [`numericIndexedVector`](/docs/sql-reference/functions/numeric-indexed-vector-functions#create-numeric-indexed-vector-object)

**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[​](#numericIndexedVectorPointwiseGreater "Direct link to numericIndexedVectorPointwiseGreater")

Introduced in: v25.7.0