ReferenceSQL ReferenceAggregate Functions

distinctDynamicTypes

Calculates the list of distinct data types stored in Dynamic column.

This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See SQL interface scope.

Calculates the list of distinct data types stored in Dynamic column.

Syntax

distinctDynamicTypes(dynamic)

Arguments

  • dynamic — Dynamic column. Dynamic

Returned value

Returns the sorted list of data type names. Array(String)

Examples

Basic usage with mixed types

DROP TABLE IF EXISTS test_dynamic;
CREATE TABLE test_dynamic(d Dynamic) ENGINE = Memory;
INSERT INTO test_dynamic VALUES (42), (NULL), ('Hello'), ([1, 2, 3]), ('2020-01-01'), (map(1, 2)), (43), ([4, 5]), (NULL), ('World'), (map(3, 4));

SELECT distinctDynamicTypes(d) FROM test_dynamic;
┌─distinctDynamicTypes(d)──────────────────────────────────────────┐
│ ['Array(Int64)', 'Date', 'Int64', 'Map(UInt8, UInt8)', 'String'] │
└──────────────────────────────────────────────────────────────────┘

Introduced in version 24.9.0.