Other functions

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

Introduced in: v24.2.0

Returns the variant type name for each row of `Variant` column. If row contains NULL, it returns 'None' for it.

**Syntax**

```
variantType(variant)
```

**Arguments**

- `variant` — Variant column. [`Variant`](/docs/sql-reference/data-types/variant)

**Returned value**

Returns an Enum column with variant type name for each row. [`Enum`](/docs/sql-reference/data-types/enum)

**Examples**

**Usage example**

```
CREATE TABLE test (v Variant(UInt64, String, Array(UInt64))) ENGINE = Memory;
INSERT INTO test VALUES (NULL), (42), ('Hello, World!'), ([1, 2, 3]);
SELECT variantType(v) FROM test;
```

```
┌─variantType(v)─┐
│ None           │
│ UInt64         │
│ String         │
│ Array(UInt64)  │
└────────────────┘
```

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

Introduced in: v1.1.0

Returns the current version of ClickHouse as a string in the form: `major_version.minor_version.patch_version.number_of_commits_since_the_previous_stable_release`.
If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard.
Otherwise, it produces a constant value.

**Syntax**

```
version()
```

**Arguments**

- None.

**Returned value**

Returns the current version of ClickHouse. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT version()
```

```
┌─version()─┐
│ 24.2.1.1  │
└───────────┘
```

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

Introduced in: v1.1.0

Calculates the approximate width when outputting values to the console in text format (tab-separated).
This function is used by the system to implement Pretty formats.
`NULL` is represented as a string corresponding to `NULL` in Pretty formats.

**Syntax**

```
visibleWidth(x)
```

**Arguments**

- `x` — A value of any data type. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns the approximate width of the value when displayed in text format. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Calculate visible width of NULL**

```
SELECT visibleWidth(NULL)
```

```
┌─visibleWidth(NULL)─┐
│                  4 │
└────────────────────┘
```

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

Introduced in: v21.11.0

Returns the uptime of the current ZooKeeper session in seconds.

**Syntax**

```
zookeeperSessionUptime()
```

**Arguments**

- None.

**Returned value**

Returns the uptime of the current ZooKeeper session in seconds. [`UInt32`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT zookeeperSessionUptime();
```

```
┌─zookeeperSessionUptime()─┐
│                      286 │
└──────────────────────────┘
```

- [FQDN](#FQDN)- [MACNumToString](#MACNumToString)- [MACStringToNum](#MACStringToNum)- [MACStringToOUI](#MACStringToOUI)- [authenticatedUser](#authenticatedUser)- [bar](#bar)- [blockNumber](#blockNumber)- [blockSerializedSize](#blockSerializedSize)- [blockSize](#blockSize)- [buildId](#buildId)- [byteSize](#byteSize)- [catboostEvaluate](#catboostEvaluate)- [colorOKLABToSRGB](#colorOKLABToSRGB)- [colorOKLCHToSRGB](#colorOKLCHToSRGB)- [colorSRGBToOKLAB](#colorSRGBToOKLAB)- [colorSRGBToOKLCH](#colorSRGBToOKLCH)- [connectionId](#connectionId)- [countDigits](#countDigits)- [currentDatabase](#currentDatabase)- [currentProfiles](#currentProfiles)- [currentQueryID](#currentQueryID)- [currentRoles](#currentRoles)- [currentSchemas](#currentSchemas)- [currentUser](#currentUser)- [defaultProfiles](#defaultProfiles)- [defaultRoles](#defaultRoles)- [defaultValueOfArgumentType](#defaultValueOfArgumentType)- [defaultValueOfTypeName](#defaultValueOfTypeName)- [displayName](#displayName)- [dumpColumnStructure](#dumpColumnStructure)- [enabledProfiles](#enabledProfiles)- [enabledRoles](#enabledRoles)- [errorCodeToName](#errorCodeToName)- [file](#file)- [filesystemAvailable](#filesystemAvailable)- [filesystemCapacity](#filesystemCapacity)- [filesystemUnreserved](#filesystemUnreserved)- [finalizeAggregation](#finalizeAggregation)- [flipCoordinates](#flipCoordinates)- [formatQuery](#formatQuery)- [formatQueryOrNull](#formatQueryOrNull)- [formatQuerySingleLine](#formatQuerySingleLine)- [formatQuerySingleLineOrNull](#formatQuerySingleLineOrNull)- [formatReadableDecimalSize](#formatReadableDecimalSize)- [formatReadableQuantity](#formatReadableQuantity)- [formatReadableSize](#formatReadableSize)- [formatReadableTimeDelta](#formatReadableTimeDelta)- [fuzzQuery](#fuzzQuery)- [generateRandomStructure](#generateRandomStructure)- [generateSerialID](#generateSerialID)- [getClientHTTPHeader](#getClientHTTPHeader)- [getMacro](#getMacro)- [getMaxTableNameLengthForDatabase](#getMaxTableNameLengthForDatabase)- [getMergeTreeSetting](#getMergeTreeSetting)- [getOSKernelVersion](#getOSKernelVersion)- [getServerPort](#getServerPort)- [getServerSetting](#getServerSetting)- [getSetting](#getSetting)- [getSettingOrDefault](#getSettingOrDefault)- [getSizeOfEnumType](#getSizeOfEnumType)- [getSubcolumn](#getSubcolumn)- [getTypeSerializationStreams](#getTypeSerializationStreams)- [globalVariable](#globalVariable)- [hasColumnInTable](#hasColumnInTable)- [hasThreadFuzzer](#hasThreadFuzzer)- [hostName](#hostName)- [icebergBucket](#icebergBucket)- [icebergTruncate](#icebergTruncate)- [identity](#identity)- [ignore](#ignore)- [indexHint](#indexHint)- [initialQueryID](#initialQueryID)- [initialQueryStartTime](#initialQueryStartTime)- [initializeAggregation](#initializeAggregation)- [isConstant](#isConstant)- [isDecimalOverflow](#isDecimalOverflow)- [joinGet](#joinGet)- [joinGetOrNull](#joinGetOrNull)- [lowCardinalityIndices](#lowCardinalityIndices)- [lowCardinalityKeys](#lowCardinalityKeys)- [materialize](#materialize)- [minSampleSizeContinuous](#minSampleSizeContinuous)- [minSampleSizeConversion](#minSampleSizeConversion)- [neighbor](#neighbor)- [normalizeQuery](#normalizeQuery)- [normalizeQueryKeepNames](#normalizeQueryKeepNames)- [normalizedQueryHash](#normalizedQueryHash)- [normalizedQueryHashKeepNames](#normalizedQueryHashKeepNames)- [parseReadableSize](#parseReadableSize)- [parseReadableSizeOrNull](#parseReadableSizeOrNull)- [parseReadableSizeOrZero](#parseReadableSizeOrZero)- [parseTimeDelta](#parseTimeDelta)- [partitionId](#partitionId)- [queryID](#queryID)- [revision](#revision)- [rowNumberInAllBlocks](#rowNumberInAllBlocks)- [rowNumberInBlock](#rowNumberInBlock)- [runningAccumulate](#runningAccumulate)- [runningConcurrency](#runningConcurrency)- [runningDifference](#runningDifference)- [runningDifferenceStartingWithFirstValue](#runningDifferenceStartingWithFirstValue)- [serverUUID](#serverUUID)- [shardCount](#shardCount)- [shardNum](#shardNum)- [showCertificate](#showCertificate)- [sleep](#sleep)- [sleepEachRow](#sleepEachRow)- [structureToCapnProtoSchema](#structureToCapnProtoSchema)- [structureToProtobufSchema](#structureToProtobufSchema)- [tcpPort](#tcpPort)- [throwIf](#throwIf)- [toColumnTypeName](#toColumnTypeName)- [toTypeName](#toTypeName)- [transactionID](#transactionID)- [transactionLatestSnapshot](#transactionLatestSnapshot)- [transactionOldestSnapshot](#transactionOldestSnapshot)- [transform](#transform)- [uniqThetaIntersect](#uniqThetaIntersect)- [uniqThetaNot](#uniqThetaNot)- [uniqThetaUnion](#uniqThetaUnion)- [uptime](#uptime)- [variantElement](#variantElement)- [variantType](#variantType)- [version](#version)- [visibleWidth](#visibleWidth)- [zookeeperSessionUptime](#zookeeperSessionUptime)

Was this page helpful?