Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.
In OpenTelemetry, every trace span carries a set of resource attributes â key-value metadata describing the entity that produced the telemetry (service name, host, cloud region, Kubernetes pod, etc.). The set of keys varies between services and environments, making this a natural fit for ClickHouse’s Map type: the keys are dynamic and application-specific, but any given row typically has only a handful of them.In this quickstart you’ll use clickhouse-local to load real OTel trace data from a CSV file into a table with Map(LowCardinality(String), String) columns, and learn how to query, filter, aggregate, and optimise map data.
1
Download the sample data
The dataset contains 6,120 OTel trace spans exported from a demo microservices application. Each row includes a ResourceAttributes and SpanAttributes column containing dynamic key-value pairs as JSON maps.
Save the file to a directory you can easily reference, for example ~/data/data-otel-traces.csv.Download data-otel-traces.csv (2.9 MB)Here’s what a single row looks like:
Launch clickhouse-local and create the following table with a schema matching the CSV.
The key column is ResourceAttributes Map(LowCardinality(String), String) - using LowCardinality on the key type because OTel attribute keys are drawn from a relatively small, repeating set.
Now load the CSV using the file table engine. Adjust the path to where you saved the file:
INSERT INTO otel_tracesSELECT * FROM file('~/data/data-otel-traces.csv', CSVWithNames);
Confirm the data was loaded:
SELECT count() FROM otel_traces;
You should see 6,120 rows.
3
Query the data
Access a specific key â use bracket syntax to pull a value out of the map. If the key doesn’t exist on a given row, you get the default for the value type (empty string for String):
SELECT ServiceName, SpanName, ResourceAttributes['host.name'] AS host, ResourceAttributes['k8s.pod.name'] AS pod, ResourceAttributes['deployment.environment'] AS envFROM otel_tracesLIMIT 10;
Filter by a map value â find all spans from a specific service name:
SELECT Timestamp, SpanName, Duration / 1e6 AS duration_msFROM otel_tracesWHERE ResourceAttributes['service.name'] = 'cartservice'ORDER BY TimestampLIMIT 10;
Check whether a key exists â not every span has Kubernetes metadata. Use mapContains to find which ones do:
SELECT ServiceName, SpanName, mapContains(ResourceAttributes, 'k8s.node.name') AS has_node_infoFROM otel_tracesLIMIT 10;
Inspect all keys present across the dataset â useful for understanding what instrumentation is producing:
SELECT DISTINCT arrayJoin(mapKeys(ResourceAttributes)) AS keyFROM otel_tracesORDER BY key;
Explode a map into rows with ARRAY JOIN â turn each key-value pair into its own row, handy for building attribute inventories or feeding dashboards:
SELECT ServiceName, key, valueFROM otel_tracesARRAY JOIN mapKeys(ResourceAttributes) AS key, mapValues(ResourceAttributes) AS valueWHERE ServiceName = 'cartservice'LIMIT 20;
Filter maps with mapFilter â extract only the Kubernetes-related attributes from each span:
SELECT ServiceName, mapFilter((k, v) -> k LIKE 'k8s.%', ResourceAttributes) AS k8s_attrsFROM otel_tracesWHERE mapContains(ResourceAttributes, 'k8s.pod.name')LIMIT 10;
Find error spans and their resource context â combine regular column filters with map access:
SELECT Timestamp, ServiceName, SpanName, ResourceAttributes['host.name'] AS host, ResourceAttributes['k8s.pod.name'] AS pod, SpanAttributes['error.type'] AS error_type, SpanAttributes['error.message'] AS error_messageFROM otel_tracesWHERE StatusCode = 'STATUS_CODE_ERROR';
4
Aggregate across maps with the -Map combinator
ClickHouse’s -Map aggregate combinator lets you apply any aggregate function to a Map column and have it operate on each key independently. The result is itself a Map â one entry per key, with the aggregated value. This is especially powerful for OTel metrics, where counters or gauges are stored as map values.To demonstrate, create a small metrics table where each row records HTTP status code counts as a Map(String, UInt64):
Now use sumMap to total the counts per status code for each service:
SELECT ServiceName, sumMap(StatusCounts) AS total_by_statusFROM otel_http_status_countsGROUP BY ServiceName;
The -Map suffix works with any aggregate function, so you can use minMap, maxMap, or avgMap just as easily:
SELECT ServiceName, avgMap(StatusCounts) AS avg_by_status, maxMap(StatusCounts) AS peak_by_statusFROM otel_http_status_countsGROUP BY ServiceName;
You can also combine it with other combinators. For example, sumMapIf lets you conditionally aggregate â here, only summing the minute windows where the service already had errors:
SELECT ServiceName, sumMapIf(StatusCounts, StatusCounts['5xx'] > 0) AS totals_in_error_windowsFROM otel_http_status_countsGROUP BY ServiceName;
Why this matters for OTel: When your OTel Collector writes per-minute status code breakdowns into ClickHouse, sumMap lets you roll them up to hourly or daily totals in a single query â no ARRAY JOIN, no unpivoting, no knowing the full set of keys in advance. Any key that appears in any row is automatically included in the result.
5
Optimise for frequently queried keys
If you find yourself constantly filtering on the same map key â host.name is a common one â you can extract it into a materialized column. This avoids the linear scan through the map on every query:
ALTER TABLE otel_traces ADD COLUMN HostName String MATERIALIZED ResourceAttributes['host.name'];
For existing data, backfill the column:
ALTER TABLE otel_traces MATERIALIZE COLUMN HostName;
Now WHERE HostName = 'prod-cart-01' reads a single, dedicated column instead of the entire map. This is the recommended pattern in the OTel ClickHouse schema for any attribute you query frequently.
Map(LowCardinality(String), String) is the idiomatic type for OTel attributes â flexible enough to handle varying key sets, and LowCardinality keeps the key storage efficient.
Bracket syntax (map['key']) is the most common way to access values, but remember it scans linearly â fine for maps with tens of keys, not ideal for hundreds.
Materialized columns are the escape hatch: when a map key becomes a hot filter target, promote it to a real column for indexed, columnar access.
mapContains, mapKeys, mapValues, mapFilter and ARRAY JOIN give you a rich toolkit for exploring and transforming map data without leaving SQL.
The -Map aggregate combinator (sumMap, avgMap, maxMap, etc.) aggregates each key independently across rows â ideal for rolling up OTel metric counters without needing to know the key set in advance. It composes with other combinators too (e.g. sumMapIf).
{"docsConfig":{"theme":"maple","$schema":"https://mintlify.com/docs.json","name":"ClickHouse Documentation","colors":{"primary":"#1c1c1c","light":"#333431","dark":"#fdff75"},"logo":{"light":"https://mintcdn.com/private-7c7dfe99/h2VHbIjccjT9ClSc/_site/logo/light.svg?fit=max\u0026auto=format\u0026n=h2VHbIjccjT9ClSc\u0026q=85\u0026s=b8a838f982def2b530a95016300bc7ec","dark":"https://mintcdn.com/private-7c7dfe99/h2VHbIjccjT9ClSc/_site/logo/dark.svg?fit=max\u0026auto=format\u0026n=h2VHbIjccjT9ClSc\u0026q=85\u0026s=563dcf3fc5bb3694597dec207c9b4ecf"},"favicon":"https://mintcdn.com/private-7c7dfe99/h2VHbIjccjT9ClSc/_site/favicon.svg?fit=max\u0026auto=format\u0026n=h2VHbIjccjT9ClSc\u0026q=85\u0026s=9a2d9de19e9259c4b5260fa5bfa26851","appearance":{"default":"dark"},"background":{"color":{"light":"#FFFFFF","dark":"#151515"}},"navbar":{},"fonts":{"family":"Inter"},"styling":{"eyebrows":"breadcrumbs","latex":true},"integrations":{"clarity":{"projectId":"xgummrwgj9"},"gtm":{"tagId":"GTM-WTNTDT7W"}},"contextual":{"options":["copy","view","download-pdf",{"title":"Set up the ClickHouse documentation MCP server","description":"Setup instructions for the ClickHouse documentation MCP server","icon":"/images/icons/icon-mcp.svg","href":"https://clickhouse.com/docs/resources/support-center/knowledge-base/setup-installation/set-up-clickhouse-documentation-mcp-server"}],"display":"toc"},"interaction":{"drilldown":false},"metadata":{"timestamp":true},"variables":{"airgap_server_tag":"26.4.1.2709","airgap_keeper_tag":"26.2.1.258","airgap_operator_tag":"1.22992.1","airgap_cr_helm_tag":"1.11.11","airgap_api_tag":"1.175.4","airgap_api_helm_tag":"1.175.4","airgap_preflight_chart_tag":"1.38.7","airgap_support_bundle_tag":"1.12.0"},"navigation":{"languages":[{"language":"en","href":""},{"language":"ar","href":"ar"},{"language":"es","href":"es"},{"language":"fr","href":"fr"},{"language":"ja","href":"ja"},{"language":"ko","href":"ko"},{"language":"pt-BR","href":"pt-BR"},{"language":"ru","href":"ru"},{"language":"zh","href":"zh"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"private-7c7dfe99","hasAudioNarration":false,"actualSubdomain":"private-7c7dfe99","customDomains":["clickhouse.com"],"gitSource":{"_id":"6ad7fa91692c7c940ff17a19","type":"github","owner":"clickhouse","repo":"clickhouse","deployBranch":"master","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae8d9fc28a88ed9db40f71c","collectionId":"2dfa09da-3a3e-4782-ad6a-6694be472bd7","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae8d9fc28a88ed9db40f71c"},"feedback":{"thumbs":true,"edits":true,"issues":true,"contextualFeedback":{"allowEmail":false},"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED","enabled":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae8d9fc28a88ed9db40f71c","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"en","tag":"Database","count":1751},{"language":"ja","tag":"データベース","count":1737},{"language":"pt-BR","tag":"Banco de dados","count":1737},{"language":"zh","tag":"数据库","count":1737},{"language":"ar","tag":"قاعدة البيانات","count":1736},{"language":"es","tag":"Base de datos","count":1736},{"language":"fr","tag":"Base de données","count":1736},{"language":"ko","tag":"데이터베이스","count":1736},{"language":"ru","tag":"База данных","count":1736},{"language":"en","tag":"Reference","count":1576},{"language":"ar","tag":"المرجع","count":1565},{"language":"es","tag":"Referencia","count":1565},{"language":"fr","tag":"Référence","count":1565},{"language":"ja","tag":"リファレンス","count":1565},{"language":"ko","tag":"참고","count":1565},{"language":"pt-BR","tag":"Referência","count":1565},{"language":"ru","tag":"Справочник","count":1565},{"language":"zh","tag":"参考文档","count":1565},{"language":"en","tag":"Solutions","count":560},{"language":"ar","tag":"الحلول","count":554},{"language":"es","tag":"Soluciones","count":554},{"language":"fr","tag":"Solutions","count":554},{"language":"ja","tag":"ソリューション","count":554},{"language":"ko","tag":"솔루션","count":554},{"language":"pt-BR","tag":"Soluções","count":554},{"language":"ru","tag":"Решения","count":554},{"language":"zh","tag":"解决方案","count":554},{"language":"es","tag":"Configuración","count":531},{"language":"ja","tag":"設定","count":531},{"language":"en","tag":"Settings","count":509},{"language":"ar","tag":"الإعدادات","count":505},{"language":"fr","tag":"Paramètres","count":505},{"language":"ko","tag":"설정","count":505},{"language":"pt-BR","tag":"Configurações","count":505},{"language":"ru","tag":"Настройки","count":505},{"language":"zh","tag":"设置","count":505},{"language":"en","tag":"Functions","count":330},{"language":"ar","tag":"الدوال","count":328},{"language":"es","tag":"Funciones","count":328},{"language":"fr","tag":"Fonctions","count":328},{"language":"ja","tag":"関数","count":328},{"language":"ko","tag":"함수","count":328},{"language":"pt-BR","tag":"Funções","count":328},{"language":"ru","tag":"Функции","count":328},{"language":"zh","tag":"函数","count":328},{"language":"en","tag":"Integrations","count":300},{"language":"ko","tag":"통합","count":296},{"language":"zh","tag":"集成","count":296},{"language":"ar","tag":"التكاملات","count":293},{"language":"es","tag":"Integraciones","count":293},{"language":"fr","tag":"Intégrations","count":293},{"language":"pt-BR","tag":"Integrações","count":293},{"language":"ru","tag":"Интеграции","count":293},{"language":"pt-BR","tag":"Recursos","count":291},{"language":"ja","tag":"インテグレーション","count":268},{"language":"en","tag":"Session Settings","count":261},{"language":"ar","tag":"إعدادات session","count":260},{"language":"es","tag":"Configuración de sesión","count":260},{"language":"fr","tag":"Paramètres de session","count":260},{"language":"ja","tag":"session 設定","count":260},{"language":"ko","tag":"세션 설정","count":260},{"language":"pt-BR","tag":"Configurações de sessão","count":260},{"language":"ru","tag":"Настройки сеанса","count":260},{"language":"zh","tag":"会话设置","count":260},{"language":"en","tag":"ClickHouse Cloud","count":256},{"language":"ar","tag":"ClickHouse Cloud","count":255},{"language":"es","tag":"ClickHouse Cloud","count":255},{"language":"fr","tag":"ClickHouse Cloud","count":255},{"language":"ja","tag":"ClickHouse Cloud","count":255},{"language":"ko","tag":"ClickHouse Cloud","count":255},{"language":"pt-BR","tag":"ClickHouse Cloud","count":255},{"language":"ru","tag":"ClickHouse Cloud","count":255},{"language":"zh","tag":"ClickHouse Cloud","count":255},{"language":"ar","tag":"أدلة إرشادية","count":219},{"language":"en","tag":"Guides","count":219},{"language":"es","tag":"Guías","count":219},{"language":"fr","tag":"Guides","count":219},{"language":"ja","tag":"ガイド","count":219},{"language":"ko","tag":"가이드","count":219},{"language":"pt-BR","tag":"Guias","count":219},{"language":"ru","tag":"Руководства","count":219},{"language":"zh","tag":"指南","count":219},{"language":"ar","tag":"الموارد","count":213},{"language":"en","tag":"Resources","count":213},{"language":"es","tag":"Recursos","count":213},{"language":"fr","tag":"Ressources","count":213},{"language":"ja","tag":"リソース","count":213},{"language":"ko","tag":"자료","count":213},{"language":"ru","tag":"Ресурсы","count":213},{"language":"zh","tag":"资源","count":213},{"language":"default","tag":"Solutions","count":125},{"language":"default","tag":"ClickHouse Cloud","count":125},{"language":"default","tag":"Cloud API","count":83},{"language":"default","tag":"API reference","count":83},{"language":"default","tag":"ClickHouse Private","count":42},{"language":"default","tag":"ClickStack","count":31},{"language":"default","tag":"Service","count":24},{"language":"default","tag":"Organization","count":21},{"language":"default","tag":"Postgres","count":18},{"language":"default","tag":"How-To Guides","count":17}],"searchSettings":{"maxResults":1}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"github-push-net-diff","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"_site/styles.css","href":"/docs/_mintlify/custom/private-7c7dfe99/2a1d0d506d6c7ad1/_site/styles.css"},{"filePath":"snippets/components/Badges/badges_styles.css","content":".ClickHouseSupportedBadge,.betaBadge{background-color:#dbeafe;border-radius:16px;display:flex;align-items:center;padding:5px 12px;color:#1d4ed8;display:inline-flex;margin-right:5px;font-size:.875rem}.betaBadge::before{content:\"β\";flex:0 0 auto;margin-right:8px;font-size:1rem;font-weight:600;line-height:1}.dark a.betaBadge,a.betaBadge{color:#1d4ed8!important;text-decoration:none!important}.dark .betaBadge{background-color:#1e3a6b;color:#93c5fd}.dark a.betaBadge{color:#93c5fd!important}.ClickHouseSupportedBadge{background-color:#faff69;color:#161517}.ClickHouseSupportedIcon{margin-right:8px}.ClickHouseSupportedIcon svg path{fill:#282828}.ClickHouseSupportedBadge a{color:#000}.dark .ClickHouseSupportedBadge{background-color:#faff69;color:#161517}.dark .ClickHouseSupportedBadge a{color:#161517}.dark .ClickHouseSupportedIcon svg path{fill:#161517}.cloudNotSupportedBadge{background-color:#f6e5ff;color:#609;border-radius:16px;display:flex;align-items:center;padding:5px 12px;display:inline-flex;margin-right:5px;font-size:.875rem}.cloudNotSupportedIcon{margin-right:8px}a.cloudNotSupportedBadge{color:#609!important;text-decoration:none!important}.cloudNotSupportedIcon svg path{stroke:#609}.dark .cloudNotSupportedBadge{background-color:#33004d;color:#ecf}.dark a.cloudNotSupportedBadge{color:#ecf!important;text-decoration:none!important}.dark .cloudNotSupportedIcon svg path{stroke:#ecf}.cloudBadge{background-color:#dae6fc;color:#061d48;border-radius:16px;display:flex;align-items:center;padding:5px 12px;display:inline-flex;margin-right:5px;font-size:.875rem}.dark .cloudBadge{background-color:#061d48;color:#dae6fc}.cloudIcon{margin-right:8px}.cloudIcon svg path{stroke:#061d48}.dark .cloudIcon svg path{stroke:#dae6fc}.CommunityMaintainedBadge{background-color:#69afff;border-radius:16px;display:flex;align-items:center;padding:5px 12px;color:#fff;display:inline-flex;margin-right:5px;font-size:.875rem}.CommunityMaintainedIcon{margin-right:8px}.CommunityMaintainedIcon svg path,.dark .CommunityMaintainedIcon svg path{fill:#fff;stroke:none}.CommunityMaintainedBadge a,.CommunityMaintainedBadge svg path{color:#69afff}.dark .CommunityMaintainedBadge{background-color:#69afff;color:#fff}.dark .CommunityMaintainedBadge a{color:#fff}.deprecatedBadge{background-color:#dfdfdf;color:#53575f;border-radius:16px;display:flex;align-items:center;padding:5px 12px;display:inline-flex;margin-right:5px;font-size:.875rem}.deprecatedIcon{margin-right:8px}.dark .deprecatedBadge a,.deprecatedBadge a{color:inherit}.dark .deprecatedBadge{background-color:#414141;color:#e6e7e9}.deprecatedIcon svg path{stroke:#53575f}.dark .deprecatedIcon svg path{stroke:#e6e7e9}.enterprisePlanFeatureContainer{background-color:#f6f7fa;border-radius:4px;border:1px solid #e6e7e9;padding:12px 16px;margin-bottom:8px;font-size:.875rem}.enterprisePlanFeatureContainer p,.scalePlanFeatureContainer p{margin:0;padding:0}.enterprisePlanFeatureBadge,.experimentalBadge{border-radius:16px;display:flex;align-items:center;display:inline-flex;font-size:.875rem}.enterprisePlanFeatureBadge{background-color:#008a0b;border:1px;border-color:#437eef;color:#fff;padding:2px 12px;margin-bottom:8px}.dark .enterprisePlanFeatureContainer{background-color:#1f1f1c;border:1px solid #414141}.dark .enterprisePlanFeatureBadge{background-color:#99ffa1;color:#1f1f1c}.experimentalBadge{background-color:#f3e8ff;color:#6d28d9;padding:5px 12px;margin-right:5px}.experimentalIcon{margin-right:8px}.dark a.experimentalBadge,a.experimentalBadge{color:#6d28d9!important;text-decoration:none!important}.dark .experimentalBadge{background-color:#3b1d6b;color:#d8b4fe}.dark a.experimentalBadge{color:#d8b4fe!important}.experimentalIcon svg path{stroke:#6d28d9}.dark .experimentalIcon svg path{stroke:#d8b4fe}.PartnerBadge{background-color:#990073;border-radius:16px;display:flex;align-items:center;padding:5px 12px;color:#fff;display:inline-flex;margin-right:5px;font-size:.875rem}.PartnerBadgeIcon{margin-right:8px}.PartnerBadgeIcon svg path{fill:#fbc9ef;stroke:#990073}.PartnerBadge a,.PartnerBadge svg path{color:#990073}.dark .PartnerBadge{background-color:#990073;color:#fbeff8}.dark .PartnerBadge a{color:#fbeff8}.dark .PartnerBadgeIcon svg path{fill:#990073;stroke:#fbeff8}.privatePreviewBadge{background-color:#fef3c7;color:#b45309;border-radius:16px;display:flex;align-items:center;padding:5px 12px;display:inline-flex;margin-right:5px;font-size:.875rem}.dark .privatePreviewBadge{background-color:#4b3410;color:#fcd34d}.privatePreviewIcon{margin-right:8px}.privatePreviewIcon svg path{stroke:#b45309}.dark .privatePreviewIcon svg path{stroke:#fcd34d}.publicPreviewBadge{background-color:#dbeafe;border-radius:16px;display:flex;align-items:center;padding:5px 12px;color:#1d4ed8;display:inline-flex;margin-right:5px;font-size:.875rem}.dark .publicPreviewBadge{background-color:#1e3a6b;color:#93c5fd}.scalePlanFeatureContainer{background-color:#f6f7fa;border-radius:4px;border:1px solid #e6e7e9;padding:12px 16px;margin-bottom:8px;font-size:.875rem}.scalePlanFeatureBadge{border-radius:16px;display:flex;align-items:center;display:inline-flex;padding:2px 12px;margin-bottom:8px;font-size:.875rem}.dark .scalePlanFeatureContainer{background-color:#1f1f1c;border:1px solid #414141}.dark .scalePlanFeatureBadge,.scalePlanFeatureBadge{background-color:#1d64ec;color:#fff}"},{"filePath":"snippets/components/ClickStackAnimation/ClickStackAnimation.css","content":"@keyframes fadeInOut{0%,to{opacity:.3}50%{opacity:.8}}.clickstack-animation-wrapper{width:100%;max-width:max-content;transition:opacity .3s ease}.clickstack-animation-inner{transform-origin:top left}.clickstack-grid{display:grid;width:537px;height:537px;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr)}.clickstack-grid-item{position:relative;display:flex;align-items:center;justify-content:center}.clickstack-grid-column{display:flex;flex-direction:column;align-items:center}.clickstack-icon-box{display:flex;width:4rem;height:4rem;align-items:center;justify-content:center;border-radius:.375rem;padding:1rem;flex-shrink:0;border:1px solid rgba(113,113,122,.8);background-color:#171717}.clickstack-svg-absolute{position:absolute}.clickstack-svg-left-center{left:50%;top:50%;transform:translateY(2rem)}.clickstack-svg-right-center{right:50%;top:50%;transform:translateY(2rem)}.clickstack-svg-bottom-left{bottom:50%;left:50%;transform:translateY(-2rem)}.clickstack-svg-bottom-right{bottom:50%;right:50%;transform:translateY(-2rem)}.clickstack-logo-container{position:relative}.clickstack-logo-glow{position:absolute;inset:0;z-index:0;animation:fadeInOut 3s ease-in-out infinite;background-color:rgba(250,255,105,.6);filter:blur(40px)}.clickstack-logo-box{position:absolute;inset:0;z-index:10;display:flex;border-radius:.5rem;border:2px solid #faff69;background-color:#262626;background-image:linear-gradient(to bottom right,rgba(250,255,105,.2),rgba(250,255,105,.4))}.clickstack-logo-svg{margin:auto}:is(.light) .clickstack-logo-glow{display:none}:is(.light) .clickstack-logo-box{border-color:#faff69;background-color:#000;background-image:none}.clickstack-line-bg{stroke:#414141}.clickstack-line-animated{stroke:#faff69}:is(.light) .clickstack-line-bg{stroke:#d4d4d8}:is(.light) .clickstack-line-animated{stroke:#a1a1aa}@media (max-width:767px){.clickstack-animation-wrapper{max-width:400px}.clickstack-grid{width:400px;height:400px}}"}],"page":{"pagePath":"get-started/quickstarts/working-with-the-map-type","slug":"/get-started/quickstarts/working-with-the-map-type","pageMetadata":{"sidebarTitle":"Working with the Map type in ClickHouse","searchable":true,"title":"Working with the Map type in ClickHouse","useCases":["Observability"],"products":["OSS"],"description":"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.","href":"/get-started/quickstarts/working-with-the-map-type"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const e_1=undefined;const e_0=undefined;function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Badge,CodeBlock,Frame,Heading,Step,Steps}=_components;if(!Badge)_missingMdxReference(`Badge`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.a,{href:`/get-started/quickstarts/home`,onClick:e_0=>{e_0.preventDefault();window.location.href=(window.location.pathname.startsWith(`/docs`)?`/docs`:``)+`/get-started/quickstarts/home`},className:`mint-inline-flex mint-items-center mint-gap-1.5 mint-text-sm mint-text-gray-500 dark:mint-text-zinc-500 hover:mint-text-gray-900 dark:hover:mint-text-[#fdff75] mint-transition-colors mint-font-normal mint-no-underline`,children:[_jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`mint-shrink-0`,children:[_jsx(`path`,{d:`M19 12H5`}),_jsx(`path`,{d:`M12 19l-7-7 7-7`})]}),`All quickstarts`]}),`\n`,_jsxs(`div`,{className:`mint-mt-2 mint-flex mint-flex-wrap mint-gap-2`,children:[_jsx(Badge,{size:`lg`,color:`blue`,children:`Observability`}),_jsx(Badge,{size:`lg`,color:`orange`,children:`OSS`})]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`clickhouse-local`}),` installed on your machine. See the `,_jsx(_components.a,{href:`/concepts/features/tools-and-utilities/clickhouse-local`,children:`clickhouse-local setup guide`}),` to get started.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-youll-build`,children:`What you’ll build`}),`\n`,_jsxs(_components.p,{children:[`In OpenTelemetry, every trace span carries a set of `,_jsx(_components.strong,{children:`resource attributes`}),` â key-value metadata describing the entity that produced the telemetry (service name, host, cloud region, Kubernetes pod, etc.). The set of keys varies between services and environments, making this a natural fit for ClickHouse’s `,_jsx(_components.code,{children:`Map`}),` type: the keys are dynamic and application-specific, but any given row typically has only a handful of them.`]}),`\n`,_jsxs(_components.p,{children:[`In this quickstart you’ll use `,_jsx(_components.code,{children:`clickhouse-local`}),` to load real OTel trace data from a CSV file into a table with `,_jsx(_components.code,{children:`Map(LowCardinality(String), String)`}),` columns, and learn how to query, filter, aggregate, and optimise map data.`]}),`\n`,_jsxs(Steps,{titleSize:`h3`,children:[_jsxs(Step,{title:`Download the sample data`,id:`download-the-sample-data`,children:[_jsxs(_components.p,{children:[`The dataset contains 6,120 OTel trace spans exported from a demo microservices application. Each row includes a `,_jsx(_components.code,{children:`ResourceAttributes`}),` and `,_jsx(_components.code,{children:`SpanAttributes`}),` column containing dynamic key-value pairs as JSON maps.\nSave the file to a directory you can easily reference, for example `,_jsx(_components.code,{children:`~/data/data-otel-traces.csv`}),`.`]}),_jsxs(`a`,{href:`https://clickhouse-docs-assets.s3.us-east-1.amazonaws.com/data-otel-traces.csv`,download:true,className:`mint-inline-flex mint-items-center mint-gap-2 mint-px-3 mint-py-1.5 mint-text-sm mint-font-medium mint-rounded-lg mint-border mint-border-gray-300 dark:mint-border-white/20 mint-bg-white dark:mint-bg-[#1B1B18] mint-text-black dark:mint-text-white hover:mint-border-[#FAFF69] mint-transition-all mint-no-underline mint-mb-4`,children:[_jsx(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:_jsx(`path`,{d:`M8 1v10M8 11L4.5 7.5M8 11l3.5-3.5M2 13h12`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),_jsx(_components.p,{children:`Download data-otel-traces.csv (2.9 MB)`})]}),_jsx(_components.p,{children:`Here’s what a single row looks like:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Timestamp: 2025-12-26 00:00:45.759467000`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`TraceId: 0da128e6e3c01bc38b6b43a33e5fa522`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SpanId: 3774f759424e4006`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ParentSpanId: 2fdd1e5b66605098`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SpanName: orders receive`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SpanKind: SPAN_KIND_CONSUMER`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ServiceName: accountingservice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Duration: 5361`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`StatusCode: STATUS_CODE_UNSET`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ResourceAttributes: {\"host.name\":\"f19476836e47\",\"os.type\":\"linux\",\"process.pid\":\"1\",\"process.command_args\":\"[\\\\\"./accountingservice\\\\\"]\",\"process.executable.path\":\"...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SpanAttributes: {\"network.transport\":\"tcp\",\"messaging.destination.name\":\"orders\",\"messaging.kafka.message.offset\":\"232260\",\"messaging.message.body.size\":\"216\"...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]}),_jsxs(Step,{title:`Create the table and load the data`,id:`create-the-table-and-load-the-data`,children:[_jsxs(_components.p,{children:[`Launch `,_jsx(_components.code,{children:`clickhouse-local`}),` and create the following table with a schema matching the CSV.\nThe key column is `,_jsx(_components.code,{children:`ResourceAttributes Map(LowCardinality(String), String)`}),` - using `,_jsx(_components.code,{children:`LowCardinality`}),` on the key type because OTel attribute keys are drawn from a relatively small, repeating set.`]}),_jsx(CodeBlock,{filename:``,highlight:`[12]`,numberOfLines:`16`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` otel_traces`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` Timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DateTime64(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`9`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TraceId String,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanId String,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ParentSpanId String,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanName LowCardinality(String),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanKind LowCardinality(String),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName LowCardinality(String),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Duration UInt64,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StatusCode LowCardinality(String),`})}),`\n`,_jsx(_components.span,{className:`line line-highlight`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes Map(LowCardinality(String), String),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanAttributes Map(LowCardinality(String), String)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ENGINE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MergeTree()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (ServiceName, SpanName, toUnixTimestamp(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`Timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Now load the CSV using the `,_jsx(_components.code,{children:`file`}),` table engine. Adjust the path to where you saved the file:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'~/data/data-otel-traces.csv'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, CSVWithNames);`})]}),`\n`]})})}),_jsx(_components.p,{children:`Confirm the data was loaded:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` count`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces;`})]}),`\n`]})})}),_jsx(_components.p,{children:`You should see 6,120 rows.`})]}),_jsxs(Step,{title:`Query the data`,id:`query-the-data`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Access a specific key`}),` â use bracket syntax to pull a value out of the map. If the key doesn’t exist on a given row, you get the default for the value type (empty string for `,_jsx(_components.code,{children:`String`}),`):`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['host.name'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` host,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['k8s.pod.name'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pod,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['deployment.environment'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` env`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Filter by a map value`}),` â find all spans from a specific service name:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` Timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Duration `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 1e6 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` duration_ms`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['service.name'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'cartservice'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ORDER BY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` Timestamp`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Check whether a key exists`}),` â not every span has Kubernetes metadata. Use `,_jsx(_components.code,{children:`mapContains`}),` to find which ones do:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mapContains(ResourceAttributes, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'k8s.node.name'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` has_node_info`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Inspect all keys present across the dataset`}),` â useful for understanding what instrumentation is producing:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT DISTINCT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` arrayJoin(mapKeys(ResourceAttributes)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` key`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ORDER BY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Explode a map into rows with ARRAY JOIN`}),` â turn each key-value pair into its own row, handy for building attribute inventories or feeding dashboards:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` value`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ARRAY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` JOIN`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mapKeys(ResourceAttributes) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mapValues(ResourceAttributes) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` value`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'cartservice'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Filter maps with mapFilter`}),` â extract only the Kubernetes-related attributes from each span:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mapFilter((k, v) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`->`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` k `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIKE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'k8s.%'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, ResourceAttributes) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` k8s_attrs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mapContains(ResourceAttributes, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'k8s.pod.name'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Find error spans and their resource context`}),` â combine regular column filters with map access:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` Timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['host.name'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` host,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ResourceAttributes['k8s.pod.name'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pod,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanAttributes['error.type'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error_type,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SpanAttributes['error.message'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error_message`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StatusCode `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'STATUS_CODE_ERROR'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})]}),_jsxs(Step,{title:`Aggregate across maps with the -Map combinator`,id:`aggregate-across-maps-with-the--map-combinator`,children:[_jsxs(_components.p,{children:[`ClickHouse’s `,_jsx(_components.code,{children:`-Map`}),` aggregate combinator lets you apply any aggregate function to a `,_jsx(_components.code,{children:`Map`}),` column and have it operate on each key independently. The result is itself a `,_jsx(_components.code,{children:`Map`}),` â one entry per key, with the aggregated value. This is especially powerful for OTel metrics, where counters or gauges are stored as map values.`]}),_jsxs(_components.p,{children:[`To demonstrate, create a small metrics table where each row records HTTP status code counts as a `,_jsx(_components.code,{children:`Map(String, UInt64)`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` otel_http_status_counts`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` Timestamp`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` DateTime`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName LowCardinality(String),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StatusCounts Map(String, UInt64)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ENGINE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MergeTree()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (ServiceName, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`Timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_http_status_counts `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`VALUES`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:00:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cart-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`150`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'4xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'5xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:01:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cart-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'4xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'5xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:00:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'inventory-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`90`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'4xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:01:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'inventory-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`110`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'4xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'5xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:00:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'payment-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`50`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'5xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2025-12-26 10:01:00'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'payment-service'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'2xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`45`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'4xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'5xx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`15`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Now use `,_jsx(_components.code,{children:`sumMap`}),` to total the counts per status code for each service:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sumMap(StatusCounts) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total_by_status`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_http_status_counts`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`-Map`}),` suffix works with any aggregate function, so you can use `,_jsx(_components.code,{children:`minMap`}),`, `,_jsx(_components.code,{children:`maxMap`}),`, or `,_jsx(_components.code,{children:`avgMap`}),` just as easily:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` avgMap(StatusCounts) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` avg_by_status,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` maxMap(StatusCounts) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` peak_by_status`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_http_status_counts`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`You can also combine it with other combinators. For example, `,_jsx(_components.code,{children:`sumMapIf`}),` lets you conditionally aggregate â here, only summing the minute windows where the service already had errors:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sumMapIf(StatusCounts, StatusCounts['5xx'] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` totals_in_error_windows`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_http_status_counts`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`GROUP BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ServiceName;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Why this matters for OTel:`}),` When your OTel Collector writes per-minute status code breakdowns into ClickHouse, `,_jsx(_components.code,{children:`sumMap`}),` lets you roll them up to hourly or daily totals in a single query â no `,_jsx(_components.code,{children:`ARRAY JOIN`}),`, no unpivoting, no knowing the full set of keys in advance. Any key that appears in any row is automatically included in the result.`]})]}),_jsxs(Step,{title:`Optimise for frequently queried keys`,id:`optimise-for-frequently-queried-keys`,children:[_jsxs(_components.p,{children:[`If you find yourself constantly filtering on the same map key â `,_jsx(_components.code,{children:`host.name`}),` is a common one â you can extract it into a materialized column. This avoids the linear scan through the map on every query:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ALTER`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ADD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` COLUMN HostName String`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MATERIALIZED ResourceAttributes['host.name'];`})}),`\n`]})})}),_jsx(_components.p,{children:`For existing data, backfill the column:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ALTER`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` otel_traces MATERIALIZE COLUMN HostName;`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Now `,_jsx(_components.code,{children:`WHERE HostName = 'prod-cart-01'`}),` reads a single, dedicated column instead of the entire map. This is the recommended pattern in the OTel ClickHouse schema for any attribute you query frequently.`]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`key-takeaways`,children:`Key takeaways`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`Map(LowCardinality(String), String)`})}),` is the idiomatic type for OTel attributes â flexible enough to handle varying key sets, and `,_jsx(_components.code,{children:`LowCardinality`}),` keeps the key storage efficient.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Bracket syntax`}),` (`,_jsx(_components.code,{children:`map['key']`}),`) is the most common way to access values, but remember it scans linearly â fine for maps with tens of keys, not ideal for hundreds.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Materialized columns`}),` are the escape hatch: when a map key becomes a hot filter target, promote it to a real column for indexed, columnar access.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`mapContains`}),`, `,_jsx(_components.code,{children:`mapKeys`}),`, `,_jsx(_components.code,{children:`mapValues`}),`, `,_jsx(_components.code,{children:`mapFilter`})]}),` and `,_jsx(_components.code,{children:`ARRAY JOIN`}),` give you a rich toolkit for exploring and transforming map data without leaving SQL.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`The `,_jsx(_components.code,{children:`-Map`}),` aggregate combinator`]}),` (`,_jsx(_components.code,{children:`sumMap`}),`, `,_jsx(_components.code,{children:`avgMap`}),`, `,_jsx(_components.code,{children:`maxMap`}),`, etc.) aggregates each key independently across rows â ideal for rolling up OTel metric counters without needing to know the key set in advance. It composes with other combinators too (e.g. `,_jsx(_components.code,{children:`sumMapIf`}),`).`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsx(_components.p,{children:`Check out the following quickstarts next:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/get-started/quickstarts/create-your-first-mergetree-table`,children:`Create your first MergeTree table`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/get-started/quickstarts/create-your-first-materialized-view`,children:`Create your first materialized view`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/get-started/quickstarts/home`,children:`Common getting started issues`})}),`\n`]}),`\n`,_jsx(_components.p,{children:`Or go deeper with the reference documentation:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/reference/data-types/map`,children:`Map type reference`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/clickhouseexporter`,children:`ClickHouse OTel exporter`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/reference/functions/aggregate-functions/combinators`,children:`Aggregate function combinators`})}),`\n`]}),`\n`,_jsx(Frame,{caption:`Check out the ClickHouse academy for on-demand and live training`,children:_jsx(`a`,{href:`https://learn.clickhouse.com/`,target:`_blank`,children:_jsx(`img`,{src:`https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=27e92fc656183cc2f176211907a7aa49`,alt:`ClickHouse Academy — Master ClickHouse with expert-designed training for every skill level`,width:`560`,noZoom:true,\"data-og-width\":`1280`,\"data-og-height\":`720`,\"data-path\":`images/academy.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=280\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=c6475339b9f0b1c411bbcf3bf6d64d34 280w, https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=560\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=ac29270203fad6406e1143c42d11612b 560w, https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=840\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=d35c1a71bc25e4dc029c08244178d09f 840w, https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=1d8a3a8917d2363513041143f10b588b 1100w, https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=d70048580aaf33d88c0d82f2c3be8c8c 1650w, https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/academy.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=EDr8ydtGBgFPOQea\u0026q=85\u0026s=8f2864f7c389302c8a5ef25ba4454f60 2500w`})})}),`\n`,_jsx(`div`,{className:`mint-mt-8`,children:_jsxs(_components.a,{href:`/get-started/quickstarts/home`,onClick:e_1=>{e_1.preventDefault();window.location.href=(window.location.pathname.startsWith(`/docs`)?`/docs`:``)+`/get-started/quickstarts/home`},className:`mint-inline-flex mint-items-center mint-gap-1.5 mint-text-sm mint-text-gray-500 dark:mint-text-zinc-500 hover:mint-text-gray-900 dark:hover:mint-text-[#fdff75] mint-transition-colors mint-font-normal mint-no-underline`,children:[_jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`mint-shrink-0`,children:[_jsx(`path`,{d:`M19 12H5`}),_jsx(`path`,{d:`M12 19l-7-7 7-7`})]}),`All quickstarts`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{e_1,e_0,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"sidebarTitle":"Working with the Map type in ClickHouse","searchable":true,"title":"Working with the Map type in ClickHouse","useCases":["Observability"],"products":["OSS"],"description":"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.","href":"/get-started/quickstarts/working-with-the-map-type"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[771,918,""],[59139,59286,""]]},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"What you’ll build","slug":"what-youll-build","depth":2,"children":[{"title":"Download the sample data","slug":"download-the-sample-data","depth":3,"children":[]},{"title":"Create the table and load the data","slug":"create-the-table-and-load-the-data","depth":3,"children":[]},{"title":"Query the data","slug":"query-the-data","depth":3,"children":[]},{"title":"Aggregate across maps with the -Map combinator","slug":"aggregate-across-maps-with-the--map-combinator","depth":3,"children":[]},{"title":"Optimise for frequently queried keys","slug":"optimise-for-frequently-queried-keys","depth":3,"children":[]}]},{"title":"Key takeaways","slug":"key-takeaways","depth":2,"children":[]},{"title":"Next steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/private-7c7dfe99/a0ab956a7a3c7ff5/_site/customizations/ask-ai-button.js","/docs/_mintlify/custom/private-7c7dfe99/39eb0ad87fa3adc8/_site/customizations/clickhouse-sql-highlight.js","/docs/_mintlify/custom/private-7c7dfe99/f2f887f569696d41/_site/customizations/clickhouse-sql-lexer-wasm.js","/docs/_mintlify/custom/private-7c7dfe99/564839e4bb02c38e/_site/customizations/custom-footer.js","/docs/_mintlify/custom/private-7c7dfe99/240e3ba1823c3bae/_site/customizations/galaxy.js","/docs/_mintlify/custom/private-7c7dfe99/38fd3c627bad5620/_site/customizations/inkeep-init.js","/docs/_mintlify/custom/private-7c7dfe99/ad7415752a665282/_site/customizations/kapa-init.js","/docs/_mintlify/custom/private-7c7dfe99/c54d4536629b44db/_site/customizations/nav-icon-preload.js","/docs/_mintlify/custom/private-7c7dfe99/10c01e58e00a0bb5/_site/customizations/navbar-cta.js","/docs/_mintlify/custom/private-7c7dfe99/f75dab9369f45602/_site/customizations/raise-issue-link.js","/docs/_mintlify/custom/private-7c7dfe99/a97e716bfafb62fd/_site/customizations/scroll-reset.js","/docs/_mintlify/custom/private-7c7dfe99/bb66ab6ab59dfc53/_site/customizations/settings-legacy-redirect.js","/docs/_mintlify/custom/private-7c7dfe99/b734912855230cc2/_site/customizations/settings-legacy-routes/format-settings.js","/docs/_mintlify/custom/private-7c7dfe99/e07c37962b288c7e/_site/customizations/settings-legacy-routes/mergetree-settings.js","/docs/_mintlify/custom/private-7c7dfe99/2b8fcba9c043bce4/_site/customizations/settings-legacy-routes/server-settings.js","/docs/_mintlify/custom/private-7c7dfe99/20d8f577c04bd763/_site/customizations/settings-legacy-routes/session-settings.js","/docs/_mintlify/custom/private-7c7dfe99/3bd87f000900d6e2/_site/customizations/tab-nav.js","/docs/_mintlify/custom/private-7c7dfe99/5c7ce50607c95a70/_site/customizations/webterminal.js","/docs/_mintlify/custom/private-7c7dfe99/7b903fec76456ee0/_site/customizations/cloud-sidebar-ad.js","/docs/_mintlify/custom/private-7c7dfe99/346eac2572f9fb1d/_site/customizations/section-ticker.js"],"dynamicCss":".mint-mb-4 {\n margin-bottom: 1rem\n}\n.mint-mt-2 {\n margin-top: 0.5rem\n}\n.mint-mt-8 {\n margin-top: 2rem\n}\n.mint-flex {\n display: flex\n}\n.mint-inline-flex {\n display: inline-flex\n}\n.mint-shrink-0 {\n flex-shrink: 0\n}\n.mint-flex-wrap {\n flex-wrap: wrap\n}\n.mint-items-center {\n align-items: center\n}\n.mint-gap-1\\.5 {\n gap: 0.375rem\n}\n.mint-gap-2 {\n gap: 0.5rem\n}\n.mint-rounded-lg {\n border-radius: 0.5rem\n}\n.mint-border {\n border-width: 1px\n}\n.mint-border-gray-300 {\n --tw-border-opacity: 1;\n border-color: rgb(209 213 219 / var(--tw-border-opacity, 1))\n}\n.mint-bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1))\n}\n.mint-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem\n}\n.mint-py-1\\.5 {\n padding-top: 0.375rem;\n padding-bottom: 0.375rem\n}\n.mint-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem\n}\n.mint-font-medium {\n font-weight: 500\n}\n.mint-font-normal {\n font-weight: 400\n}\n.mint-text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity, 1))\n}\n.mint-text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1))\n}\n.mint-no-underline {\n text-decoration-line: none\n}\n.mint-transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms\n}\n.mint-transition-colors {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms\n}\n.hover\\:mint-border-\\[\\#FAFF69\\]:hover {\n --tw-border-opacity: 1;\n border-color: rgb(250 255 105 / var(--tw-border-opacity, 1))\n}\n.hover\\:mint-text-gray-900:hover {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1))\n}\n.dark\\:mint-border-white\\/20:is(.dark *) {\n border-color: rgb(255 255 255 / 0.2)\n}\n.dark\\:mint-bg-\\[\\#1B1B18\\]:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(27 27 24 / var(--tw-bg-opacity, 1))\n}\n.dark\\:mint-text-white:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1))\n}\n.dark\\:mint-text-zinc-500:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(113 113 122 / var(--tw-text-opacity, 1))\n}\n.dark\\:hover\\:mint-text-\\[\\#fdff75\\]:hover:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(253 255 117 / var(--tw-text-opacity, 1))\n}","subdomain":"private-7c7dfe99","siteName":"ClickHouse Documentation","title":"Working with the Map type in ClickHouse - ClickHouse Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/get-started/quickstarts/working-with-the-map-type","matchLevel":0},"ar":{"href":"/ar/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"es":{"href":"/es/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"fr":{"href":"/fr/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"ja":{"href":"/ja/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"ko":{"href":"/ko/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"pt-BR":{"href":"/pt-BR/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"ru":{"href":"/ru/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"zh":{"href":"/zh/get-started/quickstarts/working-with-the-map-type","matchLevel":1}}},"originalFileLocation":"get-started/quickstarts/working-with-the-map-type.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ClickHouse Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Working with the Map type in ClickHouse - ClickHouse Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ClickHouse Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://private-7c7dfe99.mintlify.app/_mintlify/api/og/v2?division=Observability\u0026amp;title=Working+with+the+Map+type+in+ClickHouse\u0026amp;description=Learn+how+to+use+the+Map+type+in+ClickHouse+to+store%2C+query%2C+and+aggregate+dynamic+key-value+data+using+OTel+resource+attributes+as+a+practical+example.\u0026amp;theme=de5161c1b5df52f178b39943\u0026amp;signature=9b51e97091636bdd85466b99c770bbe427d7d1243f55d45edc85c9ce502bc365\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Working with the Map type in ClickHouse - ClickHouse Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://private-7c7dfe99.mintlify.app/_mintlify/api/og/v2?division=Observability\u0026amp;title=Working+with+the+Map+type+in+ClickHouse\u0026amp;description=Learn+how+to+use+the+Map+type+in+ClickHouse+to+store%2C+query%2C+and+aggregate+dynamic+key-value+data+using+OTel+resource+attributes+as+a+practical+example.\u0026amp;theme=de5161c1b5df52f178b39943\u0026amp;signature=9b51e97091636bdd85466b99c770bbe427d7d1243f55d45edc85c9ce502bc365\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/private-7c7dfe99/4UShO1VxIGDRhyfj/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ClickHouse Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1c1c1c\">\u003clink data-mint-head rel=\"canonical\" href=\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/get-started/quickstarts/working-with-the-map-type.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ar\" href=\"https://clickhouse.com/docs/ar/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://clickhouse.com/docs/es/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fr\" href=\"https://clickhouse.com/docs/fr/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://clickhouse.com/docs/ja/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://clickhouse.com/docs/ko/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pt-BR\" href=\"https://clickhouse.com/docs/pt-BR/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ru\" href=\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://clickhouse.com/docs/zh/get-started/quickstarts/working-with-the-map-type\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://clickhouse.com/#organization\",\"name\":\"ClickHouse Documentation\",\"url\":\"https://clickhouse.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/private-7c7dfe99/h2VHbIjccjT9ClSc/_site/logo/light.svg?fit=max\u0026auto=format\u0026n=h2VHbIjccjT9ClSc\u0026q=85\u0026s=b8a838f982def2b530a95016300bc7ec\"}},{\"@type\":\"WebSite\",\"@id\":\"https://clickhouse.com/docs#website\",\"name\":\"ClickHouse Documentation\",\"url\":\"https://clickhouse.com/docs\",\"publisher\":{\"@id\":\"https://clickhouse.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type#webpage\",\"url\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\",\"name\":\"Working with the Map type in ClickHouse\",\"description\":\"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\",\"isPartOf\":{\"@id\":\"https://clickhouse.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get started\",\"item\":\"https://clickhouse.com/docs/get-started/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quickstarts\",\"item\":\"https://clickhouse.com/docs/get-started/quickstarts/home\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Working with the Map type in ClickHouse\",\"item\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type#article\",\"headline\":\"Working with the Map type in ClickHouse\",\"name\":\"Working with the Map type in ClickHouse\",\"description\":\"Learn how to use the Map type in ClickHouse to store, query, and aggregate dynamic key-value data using OTel resource attributes as a practical example.\",\"url\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type\",\"mainEntityOfPage\":{\"@id\":\"https://clickhouse.com/docs/get-started/quickstarts/working-with-the-map-type#webpage\"},\"publisher\":{\"@id\":\"https://clickhouse.com/#organization\"},\"isPartOf\":{\"@id\":\"https://clickhouse.com/docs#website\"}}]}\u003c/script>","siteName":"ClickHouse Documentation","nav":{"global":null,"languages":[{"language":"en","tabs":[{"tab":"Home","pages":[{"title":"Home","href":""}]},{"tab":"Database","menu":[{"item":"Get started","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-get-started.svg","pages":[{"group":"Get started","icon":"/images/menu-icon-lightning.svg","pages":[{"title":"Get started with ClickHouse","sidebarTitle":"Overview","href":"/get-started"},{"group":"Quickstarts","expanded":false,"pages":[{"sidebarTitle":"Explore quickstarts","title":"Quickstarts explorer","mode":"custom","href":"/get-started/quickstarts/home"},{"group":"All use cases","expanded":false,"pages":[{"sidebarTitle":"Cloud quickstart","title":"ClickHouse Cloud quick start","href":"/get-started/setup/cloud"},{"sidebarTitle":"Obtain your Cloud connection details","title":"Obtain your Cloud connection details","href":"/get-started/quickstarts/obtain-your-cloud-connection-details"},{"sidebarTitle":"Insert data into ClickHouse Cloud using clickhouse-client","title":"Insert data into ClickHouse Cloud using clickhouse-client","href":"/get-started/quickstarts/insert-data-using-clickhouse-client"},{"sidebarTitle":"Creating tables in ClickHouse","title":"Creating tables in ClickHouse","href":"/get-started/quickstarts/creating-tables"},{"sidebarTitle":"Selecting ClickHouse Data","title":"Selecting ClickHouse Data","href":"/get-started/quickstarts/writing-queries"},{"sidebarTitle":"Create your first MergeTree table","title":"Create your first MergeTree table","href":"/get-started/quickstarts/create-your-first-mergetree-table"}]},{"group":"Real-time analytics","expanded":false,"pages":[{"sidebarTitle":"Create your first materialized view","title":"Create your first materialized view","href":"/get-started/quickstarts/create-your-first-materialized-view"},{"sidebarTitle":"Create your first projection","title":"Create your first projection","href":"/get-started/quickstarts/create-your-first-projection"}]},{"group":"Data warehousing","expanded":false,"pages":[{"sidebarTitle":"How to connect your Iceberg catalog in ClickHouse Cloud","title":"How to connect your Iceberg catalog in ClickHouse Cloud","href":"/get-started/quickstarts/connect-your-iceberg-catalog"},{"sidebarTitle":"Updating and deleting ClickHouse data","title":"Updating and deleting ClickHouse data","description":"Describes how to perform update and delete operations in ClickHouse","href":"/get-started/quickstarts/mutations"}]},{"group":"Observability","expanded":false,"pages":[{"sidebarTitle":"Working with the Map type in ClickHouse","title":"Working with the Map type in ClickHouse","href":"/get-started/quickstarts/working-with-the-map-type"}]}]},{"group":"Introduction","expanded":true,"pages":[{"sidebarTitle":"What is ClickHouse?","description":"ClickHouse® is a column-oriented SQL database management system (DBMS) for online analytical processing (OLAP). It is available as both an open-source software and a cloud offering.","title":"What is ClickHouse?","href":"/get-started/about/intro"},{"sidebarTitle":"Why is ClickHouse so fast?","title":"Why is ClickHouse so fast?","href":"/get-started/about/why-clickhouse-is-so-fast"},{"sidebarTitle":"Why is ClickHouse unique?","title":"Distinctive Features of ClickHouse","href":"/get-started/about/distinctive-features"}]},{"group":"Use cases","expanded":true,"pages":[{"title":"Use cases","sidebarTitle":"Overview","href":"/get-started/use-cases/overview"},{"title":"Choose a service for your workload","sidebarTitle":"Choose a service","href":"/get-started/use-cases/choosing-a-service"},{"title":"Real-time analytics","sidebarTitle":"Real-time analytics","href":"/get-started/use-cases/real-time-analytics"},{"title":"Observability","sidebarTitle":"Observability","href":"/get-started/use-cases/observability"},{"title":"Data warehousing","sidebarTitle":"Data warehousing","href":"/get-started/use-cases/data-warehousing"},{"title":"Agentic analytics","sidebarTitle":"Agentic analytics","href":"/get-started/use-cases/agentic-analytics"}]},{"sidebarTitle":"Deployment modes","title":"Deployment modes","href":"/get-started/about/deployment-modes"}]},{"group":"Setup","icon":"/images/menu-icon-gear.svg","expanded":true,"pages":[{"sidebarTitle":"Install","title":"Installation instructions","href":"/get-started/setup/install"},{"sidebarTitle":"Cloud quickstart","title":"ClickHouse Cloud quick start","href":"/get-started/setup/cloud"},{"group":"Self-managed","expanded":true,"pages":[{"title":"Self-managed install","sidebarTitle":"Overview","href":"/get-started/setup/self-managed/overview"},{"group":"Local development","pages":[{"sidebarTitle":"Quick install","title":"Quick install","href":"/get-started/setup/self-managed/quick-install"},{"sidebarTitle":"clickhousectl (CLI)","title":"Install with the ClickHouse CLI","href":"/get-started/setup/self-managed/clickhousectl"},{"sidebarTitle":"Docker","title":"Install ClickHouse using Docker","href":"/get-started/setup/self-managed/docker"},{"sidebarTitle":"Source \u0026 CI builds","title":"Source \u0026 CI builds","href":"/get-started/setup/self-managed/advanced"}]},{"group":"Production server","pages":[{"sidebarTitle":"Debian/Ubuntu","title":"Install ClickHouse on Debian/Ubuntu","href":"/get-started/setup/self-managed/debian-ubuntu"},{"sidebarTitle":"Redhat/CentOS","title":"Install ClickHouse on rpm-based Linux distributions","href":"/get-started/setup/self-managed/redhat"},{"sidebarTitle":"NixOS","title":"Install ClickHouse on NixOS","href":"/get-started/setup/self-managed/nixos"},{"sidebarTitle":"Other Linux","title":"Install ClickHouse using tgz archives","href":"/get-started/setup/self-managed/other-linux"}]}]}]},{"group":"Sample datasets","icon":"/images/menu-icon-database.svg","expanded":true,"pages":[{"sidebarTitle":"Overview","title":"Tutorials and example datasets","href":"/get-started/sample-datasets/index"},{"sidebarTitle":"ClickHouse playground","title":"ClickHouse playground","href":"/get-started/sample-datasets/playground"},{"group":"Benchmarks","pages":[{"sidebarTitle":"AMPLab big data benchmark","title":"AMPLab Big Data Benchmark","href":"/get-started/sample-datasets/amplab-benchmark"},{"sidebarTitle":"Brown university benchmark","title":"Brown University Benchmark","href":"/get-started/sample-datasets/brown-benchmark"},{"sidebarTitle":"Criteo 1TB click logs","title":"Terabyte click logs from Criteo","href":"/get-started/sample-datasets/criteo"},{"title":"Join Order Benchmark (JOB)","sidebarTitle":"JOB","href":"/get-started/sample-datasets/job"},{"sidebarTitle":"Star Schema Benchmark","title":"Star Schema Benchmark (SSB, 2009)","href":"/get-started/sample-datasets/star-schema"},{"title":"TPC-DS (2012)","sidebarTitle":"TPC-DS","href":"/get-started/sample-datasets/tpcds"},{"title":"TPC-H (1999)","sidebarTitle":"TPC-H","href":"/get-started/sample-datasets/tpch"}]},{"group":"Vector search \u0026 embeddings","pages":[{"sidebarTitle":"dbpedia dataset","title":"dbpedia dataset","href":"/get-started/sample-datasets/dbpedia"},{"sidebarTitle":"Hacker News vector search dataset","title":"Hacker News vector search dataset","href":"/get-started/sample-datasets/hacker-news-vector-search"},{"sidebarTitle":"Laion-400M dataset","title":"Laion-400M dataset","href":"/get-started/sample-datasets/laion"},{"sidebarTitle":"LAION 5B dataset","title":"LAION 5B dataset","href":"/get-started/sample-datasets/laion5b"}]},{"group":"Web \u0026 social analytics","pages":[{"sidebarTitle":"Amazon customer reviews","title":"Amazon customer review","href":"/get-started/sample-datasets/amazon-reviews"},{"sidebarTitle":"Anonymized web analytics","title":"Anonymized web analytics","href":"/get-started/sample-datasets/anon-web-analytics-metrica"},{"sidebarTitle":"Github repo","title":"Writing queries in ClickHouse using GitHub data","href":"/get-started/sample-datasets/github"},{"sidebarTitle":"GitHub events","title":"GitHub events dataset","href":"/get-started/sample-datasets/github-events"},{"sidebarTitle":"Hacker news","title":"Hacker News dataset","href":"/get-started/sample-datasets/hacker-news"},{"sidebarTitle":"Stack Overflow","title":"Analyzing Stack Overflow data with ClickHouse","href":"/get-started/sample-datasets/stackoverflow"},{"sidebarTitle":"YouTube dislikes","title":"YouTube dataset of dislikes","href":"/get-started/sample-datasets/youtube-dislikes"}]},{"group":"Geo \u0026 location","pages":[{"sidebarTitle":"Cell towers","title":"Geospatial analysis with the cell tower dataset","href":"/get-started/sample-datasets/cell-towers"},{"sidebarTitle":"Foursquare OS Places","title":"Foursquare OS Places dataset","href":"/get-started/sample-datasets/foursquare-os-places"},{"sidebarTitle":"New York taxi data","title":"Geospatial analysis with the New York taxi dataset","href":"/get-started/sample-datasets/nyc-taxi"}]},{"group":"Time series \u0026 sensors","pages":[{"sidebarTitle":"Environmental sensors data","title":"Environmental sensors data","href":"/get-started/sample-datasets/environmental-sensors"},{"sidebarTitle":"NOAA Global Historical Climatology Network ","title":"NOAA Global Historical Climatology Network","href":"/get-started/sample-datasets/noaa"},{"sidebarTitle":"Taiwan historical weather datasets","title":"Taiwan historical weather datasets","href":"/get-started/sample-datasets/tw-weather"},{"sidebarTitle":"WikiStat","title":"WikiStat","href":"/get-started/sample-datasets/wikistat"}]},{"group":"Public records \u0026 open data","pages":[{"sidebarTitle":"COVID-19 open-data","title":"COVID-19 open data","href":"/get-started/sample-datasets/covid19"},{"sidebarTitle":"New York Public Library \"what's on the menu?\" dataset","title":"New York Public Library \"What's on the Menu?\" dataset","href":"/get-started/sample-datasets/menus"},{"sidebarTitle":"NYPD complaint data","title":"NYPD complaint data","href":"/get-started/sample-datasets/nypd-complaint-data"},{"sidebarTitle":"OnTime airline flight data","title":"OnTime","href":"/get-started/sample-datasets/ontime"},{"sidebarTitle":"UK property prices","title":"Analytical queries on UK property price data","href":"/get-started/sample-datasets/uk-price-paid"}]}]},{"group":"Migrate","icon":"/images/caret-double-right.svg","expanded":true,"pages":[{"sidebarTitle":"Overview","title":"Migrating Data into ClickHouse","href":"/get-started/migrate/overview"},{"group":"PostgreSQL","pages":[{"title":"Comparing PostgreSQL and ClickHouse","sidebarTitle":"Overview","href":"/get-started/migrate/postgres/overview"},{"group":"Migration guide","pages":[{"title":"Migrating data","sidebarTitle":"Part 1","href":"/get-started/migrate/postgres/migration-guide/migration-guide-part1"},{"title":"Rewriting PostgreSQL queries","sidebarTitle":"Part 2","href":"/get-started/migrate/postgres/migration-guide/migration-guide-part2"},{"title":"Data modeling techniques","sidebarTitle":"Part 3","href":"/get-started/migrate/postgres/migration-guide/migration-guide-part3"}]},{"title":"Appendix","href":"/get-started/migrate/postgres/appendix"}]},{"group":"BigQuery","pages":[{"title":"Comparing ClickHouse Cloud and BigQuery","sidebarTitle":"Overview","href":"/get-started/migrate/bigquery/overview"},{"title":"Migrating from BigQuery to ClickHouse Cloud","sidebarTitle":"Migration guide","href":"/get-started/migrate/bigquery/migrating-to-clickhouse-cloud"},{"sidebarTitle":"Loading data","title":"Loading data from BigQuery to ClickHouse","href":"/get-started/migrate/bigquery/loading-data"}]},{"group":"Snowflake","pages":[{"sidebarTitle":"Overview","title":"Snowflake to ClickHouse migration","href":"/get-started/migrate/snowflake/overview"},{"sidebarTitle":"Migration guide","title":"Migrate from Snowflake to ClickHouse","href":"/get-started/migrate/snowflake/migration-guide"},{"sidebarTitle":"SQL translation reference","title":"Migrating from Snowflake to ClickHouse","href":"/get-started/migrate/snowflake/sql-translation-reference"}]},{"group":"Elasticsearch","pages":[{"sidebarTitle":"Overview","title":"Migrate from Elasticsearch to ClickHouse","href":"/get-started/migrate/elastic/overview"}]},{"group":"Redshift","pages":[{"sidebarTitle":"Overview","title":"Comparing ClickHouse Cloud and Amazon Redshift","href":"/get-started/migrate/redshift/overview"},{"sidebarTitle":"Migration guide","title":"Amazon Redshift to ClickHouse migration guide","href":"/get-started/migrate/redshift/migration-guide"},{"sidebarTitle":"SQL translation reference","title":"Amazon Redshift SQL translation guide","href":"/get-started/migrate/redshift/sql-translation-reference"}]},{"group":"OSS to Cloud","pages":[{"sidebarTitle":"Using remoteSecure","title":"Migrating between self-managed ClickHouse and ClickHouse Cloud using remoteSecure","href":"/get-started/migrate/oss-to-cloud/clickhouse-to-cloud"},{"sidebarTitle":"Using BACKUP and RESTORE","title":"Migrating from self-managed ClickHouse to ClickHouse Cloud using backup commands","href":"/get-started/migrate/oss-to-cloud/oss-to-cloud-backup-restore"}]},{"group":"Other methods","pages":[{"sidebarTitle":"Using clickhouse-local","title":"Migrating to ClickHouse using clickhouse-local","href":"/get-started/migrate/other-methods/clickhouse-local-etl"},{"sidebarTitle":"Using a third-party ETL tool","title":"Using a third-party ETL tool","href":"/get-started/migrate/other-methods/etl-tool-to-clickhouse"},{"title":"Move data from cloud object storage to ClickHouse Cloud","href":"/get-started/migrate/other-methods/object-storage-to-clickhouse"}]}]}]},{"item":"Concepts","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-concepts.svg","pages":[{"title":"Concepts","href":"/concepts"}]},{"item":"Guides","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-guides.svg","pages":[{"title":"Guides","href":"/guides/clickhouse"}]},{"item":"Reference","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-reference.svg","pages":[{"title":"Reference","href":"/reference/home"}]}]},{"tab":"Solutions","menu":[{"item":"ClickHouse Cloud","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/section-header.svg","href":"#"},{"item":"ClickHouse Cloud","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-clickhouse-cloud.svg","pages":[{"title":"ClickHouse Cloud","href":"/products/cloud/getting-started/cloud-get-started"}]},{"item":"ClickHouse Managed Postgres","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-postgres.svg","pages":[{"title":"ClickHouse Managed Postgres","href":"/products/managed-postgres/overview"}]},{"item":"Langfuse","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/logo-langfuse.svg","href":"https://langfuse.com/docs"},{"item":"Open source","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/section-header.svg","href":"#"},{"item":"ClickStack","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-clickstack.svg","pages":[{"title":"ClickStack","href":"/clickstack"}]},{"item":"Agentic Data Stack","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-agentic-data-stack.svg","pages":[{"title":"Agentic Data Stack","href":"/products/agentic-data-stack/overview"}]},{"item":"chDB","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-chdb.svg","pages":[{"title":"chDB","href":"/chdb"}]},{"item":"Kubernetes Operator","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-kubernetes-operator.svg","pages":[{"title":"Kubernetes Operator","href":"/products/kubernetes-operator/overview"}]}],"pages":[{"title":"Solutions","href":"/products/cloud/getting-started/cloud-get-started"}]},{"tab":"Integrations","menu":[{"item":"Ecosystem","pages":[{"title":"Ecosystem","href":"/integrations/home"}]},{"item":"ClickPipes","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-clickpipes.svg","pages":[{"title":"ClickPipes","href":"/integrations/clickpipes/home"}]},{"item":"Language clients","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-language-clients.svg","pages":[{"title":"Language clients","href":"/integrations/language-clients"}]},{"item":"Connectors","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-connectors.svg","pages":[{"title":"Connectors","href":"/integrations/connectors/data-sources"}]}],"pages":[{"title":"Integrations","href":"/integrations/home"}]},{"tab":"Resources","menu":[{"item":"Support center","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-support-center.svg","pages":[{"title":"Support center","href":"/resources/support-center/home"}]},{"item":"Development \u0026 contributing","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-contribute.svg","pages":[{"title":"Development \u0026 contributing","href":"/resources/develop-contribute/introduction/developer-instruction"}]},{"item":"Changelogs","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-changelogs.svg","dropdowns":[{"dropdown":"Cloud","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-clickhouse-cloud.svg","pages":[{"title":"Cloud","href":"/resources/changelogs/cloud"}]},{"dropdown":"Open source","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-server.svg","pages":[{"title":"Open source","href":"/resources/changelogs/oss/2026"}]}]},{"item":"About","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-about.svg","pages":[{"title":"About","href":"/resources/about"}]}],"pages":[{"title":"Resources","href":"/resources/support-center/home"}]}]},{"language":"ar","pages":[{"title":"ar","href":"/ar/get-started/quickstarts/working-with-the-map-type"}]},{"language":"es","pages":[{"title":"es","href":"/es/get-started/quickstarts/working-with-the-map-type"}]},{"language":"fr","pages":[{"title":"fr","href":"/fr/get-started/quickstarts/working-with-the-map-type"}]},{"language":"ja","pages":[{"title":"ja","href":"/ja/get-started/quickstarts/working-with-the-map-type"}]},{"language":"ko","pages":[{"title":"ko","href":"/ko/get-started/quickstarts/working-with-the-map-type"}]},{"language":"pt-BR","pages":[{"title":"pt-BR","href":"/pt-BR/get-started/quickstarts/working-with-the-map-type"}]},{"language":"ru","pages":[{"title":"ru","href":"/ru/get-started/quickstarts/working-with-the-map-type"}]},{"language":"zh","pages":[{"title":"zh","href":"/zh/get-started/quickstarts/working-with-the-map-type"}]}]},"basePath":"","title":"Working with the Map type in ClickHouse - ClickHouse Documentation","buildId":"dpl_Acry4NrQAgjcikyFgVE2eJ7XQCAv","deploymentId":"dpl_Acry4NrQAgjcikyFgVE2eJ7XQCAv","dynamics":["07c022d89b"],"chunks":["Frame-D9VvKFqQ.js","DynamicMarkdown-BCpKo5ib.js"]}