Videos
Variant data type
Mark Needham
Learn about the new Variant data type in ClickHouse 25.3, which allows storing multiple data types in a single column. This tutorial covers everything from basic usage to advanced schema inference techniques for handling heterogeneous data.
- Create and cast values to variant types with multiple union types
- Use the variantType() function to determine which type is being used for each value
- Handle arrays with mixed data types using the use_variant_as_common_type setting
- Access underlying values with dot notation syntax (value.uint8, value.string)
- Apply variant types to CSV file ingestion with schema inference hints
- Understand limitations when using variant types as sorting keys
Products
Resources
© 2025 ClickHouse, Inc. HQ in the Bay Area, CA and Amsterdam, NL.