Other functions

**Returned value**

Returns the setting's current value. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Usage example**

```
SELECT getSetting('enable_analyzer');
SET enable_analyzer = false;
SELECT getSetting('enable_analyzer');
```

```
┌─getSetting('⋯_analyzer')─┐
│ true                     │
└──────────────────────────┘
┌─getSetting('⋯_analyzer')─┐
│ false                    │
└──────────────────────────┘
```

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

Introduced in: v24.10.0

Returns the current value of a setting or returns the default value specified in the second argument if the setting is not set in the current profile.

**Syntax**

```
getSettingOrDefault(setting_name, default_value)
```

**Arguments**

- `setting_name` — The setting name. [`String`](/docs/sql-reference/data-types/string)
- `default_value` — Value to return if custom\_setting is not set. Value may be of any data type or Null.

**Returned value**

Returns the current value of the specified setting or `default_value` if the setting is not set.

**Examples**

**Usage example**

```
SELECT getSettingOrDefault('custom_undef1', 'my_value');
SELECT getSettingOrDefault('custom_undef2', 100);
SELECT getSettingOrDefault('custom_undef3', NULL);
```

```
my_value
100
NULL
```

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

Introduced in: v1.1.0

Returns the number of fields in the given [`Enum`](/docs/sql-reference/data-types/enum).

**Syntax**

```
getSizeOfEnumType(x)
```

**Arguments**

- `x` — Value of type `Enum`. [`Enum`](/docs/sql-reference/data-types/enum)

**Returned value**

Returns the number of fields with `Enum` input values. [`UInt8/16`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT getSizeOfEnumType(CAST('a' AS Enum8('a' = 1, 'b' = 2))) AS x;
```

```
┌─x─┐
│ 2 │
└───┘
```

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

Introduced in: v23.3.0

Receives the expression or identifier and constant string with the name of subcolumn.

Returns requested subcolumn extracted from the expression.

**Syntax**

```
getSubcolumn(nested_value, subcolumn_name)
```

**Arguments**

- None.

**Returned value**

**Examples**

**getSubcolumn**

```
SELECT getSubcolumn(array_col, 'size0'), getSubcolumn(tuple_col, 'elem_name')
```

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

Introduced in: v22.6.0

Enumerates stream paths of a data type.
This function is intended for developmental use.

**Syntax**

```
getTypeSerializationStreams(col)
```

**Arguments**

- `col` — Column or string representation of a data-type from which the data type will be detected. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns an array with all the serialization sub-stream paths. [`Array(String)`](/docs/sql-reference/data-types/array)

**Examples**

**tuple**

```
SELECT getTypeSerializationStreams(tuple('a', 1, 'b', 2))
```

```
['{TupleElement(1), Regular}','{TupleElement(2), Regular}','{TupleElement(3), Regular}','{TupleElement(4), Regular}']
```

**map**

```
SELECT getTypeSerializationStreams('Map(String, Int64)')
```

```
['{ArraySizes}','{ArrayElements, TupleElement(keys), Regular}','{ArrayElements, TupleElement(values), Regular}']
```

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

Introduced in: v20.5.0

Takes a constant string argument and returns the value of the global variable with that name. This function is intended for compatibility with MySQL and not needed or useful for normal operation of ClickHouse. Only few dummy global variables are defined.

**Syntax**

```
globalVariable(name)
```

**Arguments**

- `name` — Global variable name. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the value of variable `name`. [`Any`](/docs/sql-reference/data-types)

**Examples**

**globalVariable**

```
SELECT globalVariable('max_allowed_packet')
```

```
67108864
```

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

Introduced in: v1.1.0

Checks if a specific column exists in a database table.
For elements in a nested data structure, the function checks for the existence of a column.
For the nested data structure itself, the function returns `0`.

**Syntax**

```
hasColumnInTable([hostname[, username[, password]],]database, table, column)
```

**Arguments**

- `database` — Name of the database. [`const String`](/docs/sql-reference/data-types/string)
- `table` — Name of the table. [`const String`](/docs/sql-reference/data-types/string)
- `column` — Name of the column. [`const String`](/docs/sql-reference/data-types/string)
- `hostname` — Optional. Remote server name to perform the check on. [`const String`](/docs/sql-reference/data-types/string)
- `username` — Optional. Username for remote server. [`const String`](/docs/sql-reference/data-types/string)
- `password` — Optional. Password for remote server. [`const String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns `1` if the given column exists, `0` otherwise. [`UInt8`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Check an existing column**

```
SELECT hasColumnInTable('system','metrics','metric')
```

```
1
```

**Check a non-existing column**

```
SELECT hasColumnInTable('system','metrics','non-existing_column')
```

```
0
```

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

Introduced in: v20.6.0

Returns whether the thread fuzzer is enabled.
THis function is only useful for testing and debugging.

**Syntax**

```
hasThreadFuzzer()
```

**Arguments**

- None.

**Returned value**

Returns whether Thread Fuzzer is effective. [`UInt8`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Check Thread Fuzzer status**

```
SELECT hasThreadFuzzer()
```

```
┌─hasThreadFuzzer()─┐
│                 0 │
└───────────────────┘
```

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

Introduced in: v20.5.0

Returns the name of the host on which this function was executed.
If the function executes on a remote server (distributed processing), the remote server name is returned.
If the function executes in the context of a distributed table, it generates a normal column with values relevant to each shard.
Otherwise it produces a constant value.

**Syntax**

```
hostName()
```

**Aliases**: `hostname`

**Arguments**

- None.

**Returned value**

Returns the host name. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT hostName()
```

```
┌─hostName()─┐
│ clickhouse │
└────────────┘
```

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

Introduced in: v25.5.0

Implements logic for the [iceberg bucket transform](https://iceberg.apache.org/spec/#bucket-transform-details.)

**Syntax**

```
icebergBucket(N, value)
```

**Arguments**

- `N` — The number of buckets, modulo. [`const (U)Int*`](/docs/sql-reference/data-types/int-uint)
- `value` — The source value to transform. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Bool`](/docs/sql-reference/data-types/boolean) or [`Decimal`](/docs/sql-reference/data-types/decimal) or [`Float*`](/docs/sql-reference/data-types/float) or [`String`](/docs/sql-reference/data-types/string) or [`FixedString`](/docs/sql-reference/data-types/fixedstring) or [`UUID`](/docs/sql-reference/data-types/uuid) or [`Date`](/docs/sql-reference/data-types/date) or [`Time`](/docs/sql-reference/data-types/time) or [`DateTime`](/docs/sql-reference/data-types/datetime)

**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**