How to Use Array Functions in ClickHouse
Last updated July 25, 2026 · By the SaturnSQL team
arrayJoin expands an array into one row per element, arrayMap applies a lambda to each element, and has() checks membership. Arrays are first-class in ClickHouse, so these often replace joins against child tables.
Expand arrays into rows
SELECT user_id, arrayJoin(tags) AS tag
FROM events
WHERE notEmpty(tags);Transform and filter
SELECT arrayMap(x -> x * 2, [1, 2, 3]) AS doubled;
SELECT count()
FROM events
WHERE has(tags, 'checkout');Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free