Other functions

**Returned value**

Returns a 32-bit hash of the source value. [`Int32`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Example**

```
SELECT icebergBucket(5, 1.0 :: Float32)
```

```
4
```

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

Introduced in: v25.3.0

Implements logic of iceberg truncate transform: <https://iceberg.apache.org/spec/#truncate-transform-details>.

**Syntax**

```
icebergTruncate(N, value)
```

**Arguments**

- `value` — The value to transform. [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Decimal`](/docs/sql-reference/data-types/decimal)

**Returned value**

The same type as the argument

**Examples**

**Example**

```
SELECT icebergTruncate(3, 'iceberg')
```

```
ice
```

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

Introduced in: v1.1.0

This function returns the argument you pass to it, which is useful for debugging and testing. It lets you bypass index usage to see full scan performance instead. The query analyzer ignores anything inside identity functions when looking for indexes to use, and it also disables constant folding.

**Syntax**

```
identity(x)
```

**Arguments**

- `x` — Input value. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns the input value unchanged. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Usage example**

```
SELECT identity(42)
```

```
42
```

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

Introduced in: v1.1.0

Accepts arbitrary arguments and unconditionally returns `0`.

**Syntax**

```
ignore(x)
```

**Arguments**

- `x` — An input value which is unused and passed only so as to avoid a syntax error. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Always returns `0`. [`UInt8`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT ignore(0, 'ClickHouse', NULL)
```

```
┌─ignore(0, 'ClickHouse', NULL)─┐
│                             0 │
└───────────────────────────────┘
```

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

Introduced in: v1.1.0

This function is intended for debugging and introspection.
It ignores its argument and always returns 1.
The arguments are not evaluated.

During index analysis, the argument of this function is assumed to not be wrapped in `indexHint`.
This allows you to select data in index ranges by the corresponding condition but without further filtering by this condition.
The index in ClickHouse is sparse and using `indexHint` will yield more data than specifying the same condition directly.

Explanation

When you run:

```
SELECT * FROM test WHERE key = 123;
```

ClickHouse does two things:

1. Uses the index to find which granules (blocks of ~8192 rows) might contain `key = 123`
2. Reads those granules and filters them row-by-row to return only rows where `key = 123`

So even if it reads 8,192 rows from disk, it only returns the 1 row that actually matches.

With `indexHint`, when you run:

```
SELECT * FROM test WHERE indexHint(key = 123);
```

ClickHouse does only one thing:

1. Uses the index to find which granules might contain key = 123 and returns all rows from those granules **without** filtering.

It returns all 8,192 rows, including rows where `key = 456`, `key = 789`, etc. (Everything that happened to be stored in the same granule.)
`indexHint()` is not for performance. It's for debugging and understanding how ClickHouse's index works:

- Which granules does my condition select?
- How many rows are in those granules?
- Is my index being used effectively?

Note: It is not possible to optimize a query with the `indexHint` function. The `indexHint` function does not optimize the query, as it does not provide any additional information for the query analysis. Having an expression inside the `indexHint` function is not anyhow better than without the `indexHint` function. The `indexHint` function can be used only for introspection and debugging purposes and it does not improve performance. If you see the usage of `indexHint` by anyone other than ClickHouse contributors, it is likely a mistake and you should remove it.

**Syntax**

```
indexHint(expression)
```

**Arguments**

- `expression` — Any expression for index range selection. [`Expression`](/docs/sql-reference/data-types/special-data-types/expression)

**Returned value**

Returns `1` in all cases. [`UInt8`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example with date filtering**

```
SELECT FlightDate AS k, count() FROM ontime WHERE indexHint(k = '2025-09-15') GROUP BY k ORDER BY k ASC;
```

```
┌──────────k─┬─count()─┐
│ 2025-09-14 │    7071 │
│ 2025-09-15 │   16428 │
│ 2025-09-16 │    1077 │
│ 2025-09-30 │    8167 │
└────────────┴─────────┘
```

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

Introduced in: v1.1.0

Returns the ID of the initial current query.
Other parameters of a query can be extracted from field `initial_query_id` in [`system.query_log`](/docs/operations/system-tables/query_log).

In contrast to [`queryID`](/docs/sql-reference/functions/other-functions#queryID) function, `initialQueryID` returns the same results on different shards.

**Syntax**

```
initialQueryID()
```

**Aliases**: `initial_query_id`

**Arguments**

- None.

**Returned value**

Returns the ID of the initial current query. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
CREATE TABLE tmp (str String) ENGINE = Log;
INSERT INTO tmp (*) VALUES ('a');
SELECT count(DISTINCT t) FROM (SELECT initialQueryID() AS t FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
```

```
┌─count(DISTINCT t)─┐
│                 1 │
└───────────────────┘
```

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

Introduced in: v25.4.0

Returns the start time of the initial current query.
`initialQueryStartTime` returns the same results on different shards.

**Syntax**

```
initialQueryStartTime()
```

**Aliases**: `initial_query_start_time`

**Arguments**

- None.

**Returned value**

Returns the start time of the initial current query. [`DateTime`](/docs/sql-reference/data-types/datetime)

**Examples**

**Usage example**

```
CREATE TABLE tmp (str String) ENGINE = Log;
INSERT INTO tmp (*) VALUES ('a');
SELECT count(DISTINCT t) FROM (SELECT initialQueryStartTime() AS t FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
```

```
┌─count(DISTINCT t)─┐
│                 1 │
└───────────────────┘
```

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

Introduced in: v20.6.0

Calculates the result of an aggregate function based on a single value.
This function can be used to initialize aggregate functions with combinator [-State](/docs/sql-reference/aggregate-functions/combinators#-state).
You can create states of aggregate functions and insert them to columns of type [`AggregateFunction`](/docs/sql-reference/data-types/aggregatefunction) or use initialized aggregates as default values.

**Syntax**

```
initializeAggregation(aggregate_function, arg1[, arg2, ...])
```

**Arguments**

- `aggregate_function` — Name of the aggregation function to initialize. [`String`](/docs/sql-reference/data-types/string)
- `arg1[, arg2, ...]` — Arguments of the aggregate function. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns the result of aggregation for every row passed to the function. The return type is the same as the return type of the function that `initializeAggregation` takes as a first argument. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Basic usage with uniqState**

```
SELECT uniqMerge(state) FROM (SELECT initializeAggregation('uniqState', number % 3) AS state FROM numbers(10000));
```

```
┌─uniqMerge(state)─┐
│                3 │
└──────────────────┘
```

**Usage with sumState and finalizeAggregation**

```
SELECT finalizeAggregation(state), toTypeName(state) FROM (SELECT initializeAggregation('sumState', number % 3) AS state FROM numbers(5));
```