v.24.9Experimental Feature

Adds Setting for Inferring Variant Type During Schema Inference

Adds a setting input_format_try_infer_variants which allows Variant type to be inferred during schema inference for text formats when there is more than one possible type for column/array elements. #63798 (Shaun Struwig).
Adds the input_format_try_infer_variants setting to enable inferring the Variant data type during schema inference for text formats when multiple possible types exist for columns or array elements.

Why it matters

This feature addresses the ambiguity when importing text data formats where a column or array element could correspond to more than one data type. By allowing inference of the Variant type in these cases, it improves data ingestion flexibility and accuracy without forcing users to specify schema explicitly.

How to use it

Enable the feature by setting input_format_try_infer_variants to 1 in the session, user, or global settings. This will make ClickHouse automatically infer the Variant type during schema inference for applicable text formats when multiple type possibilities exist.