Skip to content

Instantly share code, notes, and snippets.

@tom-clickhouse
Created October 18, 2024 07:17
Show Gist options
  • Save tom-clickhouse/c4f3da235843252b7b5c38472bdeba5d to your computer and use it in GitHub Desktop.
Save tom-clickhouse/c4f3da235843252b7b5c38472bdeba5d to your computer and use it in GitHub Desktop.
Variant type
SET
allow_experimental_variant_type=1,
use_variant_as_common_type = 1;
CREATE OR REPLACE TABLE test
(
c Variant(Int64, String, Array(Variant(Int64, String)))
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS
min_bytes_for_wide_part = 1,
min_rows_for_wide_part = 1;
INSERT INTO test values
(42),
('foo'),
([23, 24]),
(43),
(NULL),
([25]),
(44),
(''),
([26, 27]);
SELECT * FROM test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment