Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.
В OpenTelemetry каждый спан трассировки несёт набор атрибутов ресурса — метаданных в формате ключ-значение, описывающих сущность, которая создала телеметрию (имя сервиса, хост, регион облака, под Kubernetes и т. д.). Набор ключей различается в зависимости от сервиса и окружения, поэтому для таких данных естественно подходит тип Map в ClickHouse: ключи динамические и зависят от приложения, но в каждой строке их обычно лишь несколько.В этом кратком руководстве вы будете использовать clickhouse-local, чтобы загрузить реальные данные OTel-трассировки из CSV-файла в таблицу со столбцами Map(LowCardinality(String), String), а также научитесь выполнять запросы, фильтровать, агрегировать и оптимизировать данные в Map.
1
Скачайте пример данных
Набор данных содержит 6 120 спанов трассировки OTel, экспортированных из демонстрационного микросервисного приложения. Каждая строка включает столбцы ResourceAttributes и SpanAttributes с динамическими парами ключ-значение в формате JSON.
Сохраните файл в каталог, путь к которому вам будет удобно использовать, например ~/data/data-otel-traces.csv.Скачать data-otel-traces.csv (2.9 MB)Вот как выглядит одна строка:
Запустите clickhouse-local и создайте следующую таблицу со схемой, соответствующей CSV.
Ключевой столбец — ResourceAttributes Map(LowCardinality(String), String); LowCardinality используется для типа ключа, поскольку ключи атрибутов OTel берутся из относительно небольшого набора повторяющихся значений.
Теперь загрузите CSV с помощью движка таблицы file. Укажите путь к файлу, который вы сохранили:
INSERT INTO otel_tracesSELECT * FROM file('~/data/data-otel-traces.csv', CSVWithNames);
Убедитесь, что данные загружены:
SELECT count() FROM otel_traces;
Вы должны увидеть 6 120 строк.
3
Запросите данные
Доступ к конкретному ключу — используйте синтаксис с квадратными скобками, чтобы получить значение из Map. Если в данной строке такого ключа нет, будет возвращено значение по умолчанию для типа значения (пустая строка для String):
SELECT ServiceName, SpanName, ResourceAttributes['host.name'] AS host, ResourceAttributes['k8s.pod.name'] AS pod, ResourceAttributes['deployment.environment'] AS envFROM otel_tracesLIMIT 10;
Фильтрация по значению в map — найдите все спаны с определённым именем сервиса:
SELECT Timestamp, SpanName, Duration / 1e6 AS duration_msFROM otel_tracesWHERE ResourceAttributes['service.name'] = 'cartservice'ORDER BY TimestampLIMIT 10;
Проверьте, есть ли ключ — не каждый span содержит метаданные Kubernetes. Используйте mapContains, чтобы найти те, у которых они есть:
SELECT ServiceName, SpanName, mapContains(ResourceAttributes, 'k8s.node.name') AS has_node_infoFROM otel_tracesLIMIT 10;
Проверьте все ключи, встречающиеся во всём наборе данных — это полезно, чтобы понять, что именно создаёт инструментирование:
SELECT DISTINCT arrayJoin(mapKeys(ResourceAttributes)) AS keyFROM otel_tracesORDER BY key;
Разверните Map в строки с помощью ARRAY JOIN — превратите каждую пару ключ-значение в отдельную строку — это удобно для составления перечней атрибутов или наполнения панелей мониторинга:
SELECT ServiceName, key, valueFROM otel_tracesARRAY JOIN mapKeys(ResourceAttributes) AS key, mapValues(ResourceAttributes) AS valueWHERE ServiceName = 'cartservice'LIMIT 20;
Фильтруйте maps с помощью mapFilter — извлекайте из каждого спана только атрибуты, связанные с Kubernetes:
SELECT ServiceName, mapFilter((k, v) -> k LIKE 'k8s.%', ResourceAttributes) AS k8s_attrsFROM otel_tracesWHERE mapContains(ResourceAttributes, 'k8s.pod.name')LIMIT 10;
Находите спаны с ошибками и их ресурсный контекст — сочетайте обычные фильтры по столбцам с доступом к Map:
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
Агрегирование по Map с помощью комбинатора -Map
Агрегатный комбинатор -Map в ClickHouse позволяет применять любую агрегатную функцию к столбцу типа Map, при этом она выполняется отдельно для каждого ключа. Результатом тоже будет Map — по одной записи на ключ с агрегированным значением. Это особенно полезно для метрик OTel, где значения Counter или Gauge хранятся в Map.Чтобы продемонстрировать это, создайте небольшую таблицу метрик, в которой каждая строка содержит количества HTTP-кодов состояния в виде Map(String, UInt64):
Теперь используйте sumMap, чтобы суммировать количество по каждому коду статуса для каждого сервиса:
SELECT ServiceName, sumMap(StatusCounts) AS total_by_statusFROM otel_http_status_countsGROUP BY ServiceName;
Суффикс -Map работает с любой агрегатной функцией, поэтому вы можете так же легко использовать minMap, maxMap или avgMap:
SELECT ServiceName, avgMap(StatusCounts) AS avg_by_status, maxMap(StatusCounts) AS peak_by_statusFROM otel_http_status_countsGROUP BY ServiceName;
Вы также можете комбинировать его с другими комбинаторами. Например, sumMapIf позволяет выполнять условную агрегацию — в данном случае суммируются только те минутные окна, в которых у сервиса уже были ошибки:
SELECT ServiceName, sumMapIf(StatusCounts, StatusCounts['5xx'] > 0) AS totals_in_error_windowsFROM otel_http_status_countsGROUP BY ServiceName;
Почему это важно для OTel: Когда ваш OTel Collector записывает в ClickHouse поминутную разбивку по кодам статуса, sumMap позволяет агрегировать её в почасовые или суточные итоги одним запросом — без ARRAY JOIN, без разворота в строки и без необходимости заранее знать полный набор ключей. Любой ключ, встречающийся хотя бы в одной строке, автоматически включается в результат.
5
Оптимизируйте работу с часто используемыми в запросах ключами
Если вам постоянно приходится фильтровать данные по одному и тому же ключу в Map — часто это host.name — его можно вынести в материализованный столбец. Это позволит избежать линейного прохода по Map при каждом запросе:
ALTER TABLE otel_traces ADD COLUMN HostName String MATERIALIZED ResourceAttributes['host.name'];
Для существующих данных дозагрузите столбец:
ALTER TABLE otel_traces MATERIALIZE COLUMN HostName;
Теперь WHERE HostName = 'prod-cart-01' считывает один выделенный столбец вместо всего map. Это рекомендуемый подход в схеме OTel ClickHouse для любых атрибутов, по которым вы часто выполняете запросы.
Map(LowCardinality(String), String) — идиоматический тип для атрибутов OTel: он достаточно гибок, чтобы работать с меняющимися наборами ключей, а LowCardinality позволяет хранить ключи эффективно.
Синтаксис с квадратными скобками (map['key']) — самый распространённый способ доступа к значениям, но помните, что он выполняет линейный проход: для map с десятками ключей это нормально, а вот для сотен — уже не лучший вариант.
Материализованные столбцы — это выход из ситуации: когда ключ map становится частой целью фильтрации, вынесите его в отдельный столбец для индексированного, столбцового доступа.
mapContains, mapKeys, mapValues, mapFilter и ARRAY JOIN дают богатый набор инструментов для изучения и преобразования данных map, не выходя из SQL.
Агрегатный комбинатор -Map (sumMap, avgMap, maxMap и т. д.) агрегирует каждый ключ независимо по всем строкам — это идеально для свёртки счётчиков метрик OTel, когда набор ключей заранее неизвестен. Он также сочетается с другими комбинаторами (например, 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":"ru/get-started/quickstarts/working-with-the-map-type","slug":"/ru/get-started/quickstarts/working-with-the-map-type","pageMetadata":{"sidebarTitle":"Работа с типом Map в ClickHouse","searchable":true,"title":"Работа с типом Map в ClickHouse","useCases":["Обсервабилити"],"products":["OSS"],"description":"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.","href":"/ru/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: \"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\"\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:`Обсервабилити`}),_jsx(Badge,{size:`lg`,color:`orange`,children:`OSS`})]}),`\n`,_jsx(`div`,{id:`prerequisites`,children:_jsx(Heading,{level:`2`,id:`предварительные-требования`,children:`Предварительные требования`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`На вашем компьютере должен быть установлен `,_jsx(_components.strong,{children:`clickhouse-local`}),`. Чтобы начать работу, см. `,_jsx(_components.a,{href:`/ru/concepts/features/tools-and-utilities/clickhouse-local`,children:`руководство по настройке clickhouse-local`}),`.`]}),`\n`]}),`\n`,_jsx(`div`,{id:`what-youll-build`,children:_jsx(Heading,{level:`2`,id:`что-вы-создадите`,children:`Что вы создадите`})}),`\n`,_jsxs(_components.p,{children:[`В OpenTelemetry каждый спан трассировки несёт набор `,_jsx(_components.strong,{children:`атрибутов ресурса`}),` — метаданных в формате ключ-значение, описывающих сущность, которая создала телеметрию (имя сервиса, хост, регион облака, под Kubernetes и т. д.). Набор ключей различается в зависимости от сервиса и окружения, поэтому для таких данных естественно подходит тип `,_jsx(_components.code,{children:`Map`}),` в ClickHouse: ключи динамические и зависят от приложения, но в каждой строке их обычно лишь несколько.`]}),`\n`,_jsxs(_components.p,{children:[`В этом кратком руководстве вы будете использовать `,_jsx(_components.code,{children:`clickhouse-local`}),`, чтобы загрузить реальные данные OTel-трассировки из CSV-файла в таблицу со столбцами `,_jsx(_components.code,{children:`Map(LowCardinality(String), String)`}),`, а также научитесь выполнять запросы, фильтровать, агрегировать и оптимизировать данные в `,_jsx(_components.code,{children:`Map`}),`.`]}),`\n`,_jsxs(Steps,{titleSize:`h3`,children:[_jsxs(Step,{title:`Скачайте пример данных`,id:`download-the-sample-data`,children:[_jsxs(_components.p,{children:[`Набор данных содержит 6 120 спанов трассировки OTel, экспортированных из демонстрационного микросервисного приложения. Каждая строка включает столбцы `,_jsx(_components.code,{children:`ResourceAttributes`}),` и `,_jsx(_components.code,{children:`SpanAttributes`}),` с динамическими парами ключ-значение в формате JSON.\nСохраните файл в каталог, путь к которому вам будет удобно использовать, например `,_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:`Скачать data-otel-traces.csv (2.9 MB)`})]}),_jsx(_components.p,{children:`Вот как выглядит одна строка:`}),_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:`Создайте таблицу и загрузите данные`,id:`create-the-table-and-load-the-data`,children:[_jsxs(_components.p,{children:[`Запустите `,_jsx(_components.code,{children:`clickhouse-local`}),` и создайте следующую таблицу со схемой, соответствующей CSV.\nКлючевой столбец — `,_jsx(_components.code,{children:`ResourceAttributes Map(LowCardinality(String), String)`}),`; `,_jsx(_components.code,{children:`LowCardinality`}),` используется для типа ключа, поскольку ключи атрибутов OTel берутся из относительно небольшого набора повторяющихся значений.`]}),_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:[`Теперь загрузите CSV с помощью движка таблицы `,_jsx(_components.code,{children:`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:`Убедитесь, что данные загружены:`}),_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:`Вы должны увидеть 6 120 строк.`})]}),_jsxs(Step,{title:`Запросите данные`,id:`query-the-data`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Доступ к конкретному ключу`}),` — используйте синтаксис с квадратными скобками, чтобы получить значение из `,_jsx(_components.code,{children:`Map`}),`. Если в данной строке такого ключа нет, будет возвращено значение по умолчанию для типа значения (пустая строка для `,_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:`Фильтрация по значению в map`}),` — найдите все спаны с определённым именем сервиса:`]}),_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:`Проверьте, есть ли ключ`}),` — не каждый span содержит метаданные Kubernetes. Используйте `,_jsx(_components.code,{children:`mapContains`}),`, чтобы найти те, у которых они есть:`]}),_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:`Проверьте все ключи, встречающиеся во всём наборе данных`}),` — это полезно, чтобы понять, что именно создаёт инструментирование:`]}),_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:`Разверните Map в строки с помощью ARRAY JOIN`}),` — превратите каждую пару ключ-значение в отдельную строку — это удобно для составления перечней атрибутов или наполнения панелей мониторинга:`]}),_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:`Фильтруйте maps с помощью mapFilter`}),` — извлекайте из каждого спана только атрибуты, связанные с Kubernetes:`]}),_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:`Находите спаны с ошибками и их ресурсный контекст`}),` — сочетайте обычные фильтры по столбцам с доступом к Map:`]}),_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:`Агрегирование по Map с помощью комбинатора -Map`,id:`aggregate-across-maps-with-the--map-combinator`,children:[_jsxs(_components.p,{children:[`Агрегатный комбинатор `,_jsx(_components.code,{children:`-Map`}),` в ClickHouse позволяет применять любую агрегатную функцию к столбцу типа `,_jsx(_components.code,{children:`Map`}),`, при этом она выполняется отдельно для каждого ключа. Результатом тоже будет `,_jsx(_components.code,{children:`Map`}),` — по одной записи на ключ с агрегированным значением. Это особенно полезно для метрик OTel, где значения Counter или Gauge хранятся в `,_jsx(_components.code,{children:`Map`}),`.`]}),_jsxs(_components.p,{children:[`Чтобы продемонстрировать это, создайте небольшую таблицу метрик, в которой каждая строка содержит количества HTTP-кодов состояния в виде `,_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:[`Теперь используйте `,_jsx(_components.code,{children:`sumMap`}),`, чтобы суммировать количество по каждому коду статуса для каждого сервиса:`]}),_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:[`Суффикс `,_jsx(_components.code,{children:`-Map`}),` работает с любой агрегатной функцией, поэтому вы можете так же легко использовать `,_jsx(_components.code,{children:`minMap`}),`, `,_jsx(_components.code,{children:`maxMap`}),` или `,_jsx(_components.code,{children:`avgMap`}),`:`]}),_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:[`Вы также можете комбинировать его с другими комбинаторами. Например, `,_jsx(_components.code,{children:`sumMapIf`}),` позволяет выполнять условную агрегацию — в данном случае суммируются только те минутные окна, в которых у сервиса уже были ошибки:`]}),_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:`Почему это важно для OTel:`}),` Когда ваш OTel Collector записывает в ClickHouse поминутную разбивку по кодам статуса, `,_jsx(_components.code,{children:`sumMap`}),` позволяет агрегировать её в почасовые или суточные итоги одним запросом — без `,_jsx(_components.code,{children:`ARRAY JOIN`}),`, без разворота в строки и без необходимости заранее знать полный набор ключей. Любой ключ, встречающийся хотя бы в одной строке, автоматически включается в результат.`]})]}),_jsxs(Step,{title:`Оптимизируйте работу с часто используемыми в запросах ключами`,id:`optimise-for-frequently-queried-keys`,children:[_jsxs(_components.p,{children:[`Если вам постоянно приходится фильтровать данные по одному и тому же ключу в Map — часто это `,_jsx(_components.code,{children:`host.name`}),` — его можно вынести в материализованный столбец. Это позволит избежать линейного прохода по Map при каждом запросе:`]}),_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:`Для существующих данных дозагрузите столбец:`}),_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:[`Теперь `,_jsx(_components.code,{children:`WHERE HostName = 'prod-cart-01'`}),` считывает один выделенный столбец вместо всего map. Это рекомендуемый подход в схеме OTel ClickHouse для любых атрибутов, по которым вы часто выполняете запросы.`]})]})]}),`\n`,_jsx(`div`,{id:`key-takeaways`,children:_jsx(Heading,{level:`2`,id:`ключевые-выводы`,children:`Ключевые выводы`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`Map(LowCardinality(String), String)`})}),` — идиоматический тип для атрибутов OTel: он достаточно гибок, чтобы работать с меняющимися наборами ключей, а `,_jsx(_components.code,{children:`LowCardinality`}),` позволяет хранить ключи эффективно.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Синтаксис с квадратными скобками`}),` (`,_jsx(_components.code,{children:`map['key']`}),`) — самый распространённый способ доступа к значениям, но помните, что он выполняет линейный проход: для map с десятками ключей это нормально, а вот для сотен — уже не лучший вариант.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Материализованные столбцы`}),` — это выход из ситуации: когда ключ map становится частой целью фильтрации, вынесите его в отдельный столбец для индексированного, столбцового доступа.`]}),`\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`})]}),` и `,_jsx(_components.code,{children:`ARRAY JOIN`}),` дают богатый набор инструментов для изучения и преобразования данных map, не выходя из SQL.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Агрегатный комбинатор `,_jsx(_components.code,{children:`-Map`})]}),` (`,_jsx(_components.code,{children:`sumMap`}),`, `,_jsx(_components.code,{children:`avgMap`}),`, `,_jsx(_components.code,{children:`maxMap`}),` и т. д.) агрегирует каждый ключ независимо по всем строкам — это идеально для свёртки счётчиков метрик OTel, когда набор ключей заранее неизвестен. Он также сочетается с другими комбинаторами (например, `,_jsx(_components.code,{children:`sumMapIf`}),`).`]}),`\n`]}),`\n`,_jsx(`div`,{id:`next-steps`,children:_jsx(Heading,{level:`2`,id:`что-дальше`,children:`Что дальше`})}),`\n`,_jsx(_components.p,{children:`Далее ознакомьтесь со следующими руководствами по быстрому старту:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/ru/get-started/quickstarts/create-your-first-mergetree-table`,children:`Создайте свою первую таблицу семейства MergeTree`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/ru/get-started/quickstarts/create-your-first-materialized-view`,children:`Создайте свое первое materialized view`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/ru/get-started/quickstarts/home`,children:`Типичные проблемы при начале работы`})}),`\n`]}),`\n`,_jsx(_components.p,{children:`Или перейдите к более подробной справочной документации:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/ru/reference/data-types/map`,children:`Справочник по типу Map`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/clickhouseexporter`,children:`Экспортер ClickHouse OTel`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/ru/reference/functions/aggregate-functions/combinators`,children:`Комбинаторы агрегатных функций`})}),`\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":"Работа с типом Map в ClickHouse","searchable":true,"title":"Работа с типом Map в ClickHouse","useCases":["Обсервабилити"],"products":["OSS"],"description":"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.","href":"/ru/get-started/quickstarts/working-with-the-map-type"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[771,918,""],[60239,60386,""]]},"mdxExtracts":{"tableOfContents":[{"title":"Предварительные требования","slug":"предварительные-требования","depth":2,"children":[]},{"title":"Что вы создадите","slug":"что-вы-создадите","depth":2,"children":[{"title":"Скачайте пример данных","slug":"download-the-sample-data","depth":3,"children":[]},{"title":"Создайте таблицу и загрузите данные","slug":"create-the-table-and-load-the-data","depth":3,"children":[]},{"title":"Запросите данные","slug":"query-the-data","depth":3,"children":[]},{"title":"Агрегирование по Map с помощью комбинатора -Map","slug":"aggregate-across-maps-with-the--map-combinator","depth":3,"children":[]},{"title":"Оптимизируйте работу с часто используемыми в запросах ключами","slug":"optimise-for-frequently-queried-keys","depth":3,"children":[]}]},{"title":"Ключевые выводы","slug":"ключевые-выводы","depth":2,"children":[]},{"title":"Что дальше","slug":"что-дальше","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":"Работа с типом Map в ClickHouse - ClickHouse Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/get-started/quickstarts/working-with-the-map-type","matchLevel":1},"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":0},"zh":{"href":"/zh/get-started/quickstarts/working-with-the-map-type","matchLevel":1}}},"originalFileLocation":"ru/get-started/quickstarts/working-with-the-map-type.mdx","locale":"ru"},"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=\"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\">\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=\"Работа с типом Map в ClickHouse - ClickHouse Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ClickHouse Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://clickhouse.com/docs/ru/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=%D0%9E%D0%B1%D1%81%D0%B5%D1%80%D0%B2%D0%B0%D0%B1%D0%B8%D0%BB%D0%B8%D1%82%D0%B8\u0026amp;title=%D0%A0%D0%B0%D0%B1%D0%BE%D1%82%D0%B0+%D1%81+%D1%82%D0%B8%D0%BF%D0%BE%D0%BC+Map+%D0%B2+ClickHouse\u0026amp;description=%D0%A3%D0%B7%D0%BD%D0%B0%D0%B9%D1%82%D0%B5%2C+%D0%BA%D0%B0%D0%BA+%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D1%82%D0%B8%D0%BF+Map+%D0%B2+ClickHouse+%D0%B4%D0%BB%D1%8F+%D1%85%D1%80%D0%B0%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F%2C+%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B2+%D0%B8+%D0%B0%D0%B3%D1%80%D0%B5%D0%B3%D0%B0%D1%86%D0%B8%D0%B8+%D0%B4%D0%B8%D0%BD%D0%B0%D0%BC%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85+%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85+%D0%B2+%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BD%D0%B0+%D0%BF%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%BC+%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80%D0%B5+%D0%B0%D1%82%D1%80%D0%B8%D0%B1%D1%83%D1%82%D0%BE%D0%B2+\u0026amp;theme=de5161c1b5df52f178b39943\u0026amp;signature=5725aa6ea1bafaf49a074954ee5efa9412a88ac386ce1fd5c5c20f2d2e67e0e8\">\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=\"Работа с типом Map в ClickHouse - ClickHouse Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://private-7c7dfe99.mintlify.app/_mintlify/api/og/v2?division=%D0%9E%D0%B1%D1%81%D0%B5%D1%80%D0%B2%D0%B0%D0%B1%D0%B8%D0%BB%D0%B8%D1%82%D0%B8\u0026amp;title=%D0%A0%D0%B0%D0%B1%D0%BE%D1%82%D0%B0+%D1%81+%D1%82%D0%B8%D0%BF%D0%BE%D0%BC+Map+%D0%B2+ClickHouse\u0026amp;description=%D0%A3%D0%B7%D0%BD%D0%B0%D0%B9%D1%82%D0%B5%2C+%D0%BA%D0%B0%D0%BA+%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D1%82%D0%B8%D0%BF+Map+%D0%B2+ClickHouse+%D0%B4%D0%BB%D1%8F+%D1%85%D1%80%D0%B0%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F%2C+%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B2+%D0%B8+%D0%B0%D0%B3%D1%80%D0%B5%D0%B3%D0%B0%D1%86%D0%B8%D0%B8+%D0%B4%D0%B8%D0%BD%D0%B0%D0%BC%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85+%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85+%D0%B2+%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BD%D0%B0+%D0%BF%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%BC+%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80%D0%B5+%D0%B0%D1%82%D1%80%D0%B8%D0%B1%D1%83%D1%82%D0%BE%D0%B2+\u0026amp;theme=de5161c1b5df52f178b39943\u0026amp;signature=5725aa6ea1bafaf49a074954ee5efa9412a88ac386ce1fd5c5c20f2d2e67e0e8\">\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/ru/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/ru/get-started/quickstarts/working-with-the-map-type.md\">\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=\"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=\"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/ru/get-started/quickstarts/working-with-the-map-type#webpage\",\"url\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type\",\"name\":\"Работа с типом Map в ClickHouse\",\"description\":\"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\",\"isPartOf\":{\"@id\":\"https://clickhouse.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get started\",\"item\":\"https://clickhouse.com/docs/ru/get-started/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Быстрый старт\",\"item\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/home\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Работа с типом Map в ClickHouse\",\"item\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type#article\",\"headline\":\"Работа с типом Map в ClickHouse\",\"name\":\"Работа с типом Map в ClickHouse\",\"description\":\"Узнайте, как использовать тип Map в ClickHouse для хранения, запросов и агрегации динамических данных в формате ключ-значение на практическом примере атрибутов ресурса в OTel.\",\"url\":\"https://clickhouse.com/docs/ru/get-started/quickstarts/working-with-the-map-type\",\"mainEntityOfPage\":{\"@id\":\"https://clickhouse.com/docs/ru/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","pages":[{"title":"en","href":"/get-started/quickstarts/working-with-the-map-type"}]},{"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","tabs":[{"tab":"Главная","pages":[{"title":"Главная","href":"/ru"}]},{"tab":"База данных","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":"Начало работы с ClickHouse","sidebarTitle":"Обзор","href":"/ru/get-started"},{"group":"Быстрый старт","expanded":false,"pages":[{"sidebarTitle":"Обзор быстрого старта","title":"Обзор руководств по быстрому старту","mode":"custom","href":"/ru/get-started/quickstarts/home"},{"group":"Все сценарии использования","expanded":false,"pages":[{"sidebarTitle":"Быстрый старт в Cloud","title":"Быстрый старт с ClickHouse Cloud","href":"/ru/get-started/setup/cloud"},{"sidebarTitle":"Как получить сведения о подключении к Cloud","title":"Как получить сведения о подключении к Cloud","href":"/ru/get-started/quickstarts/obtain-your-cloud-connection-details"},{"sidebarTitle":"Вставка данных в ClickHouse Cloud с помощью clickhouse-client","title":"Вставка данных в ClickHouse Cloud с помощью clickhouse-client","href":"/ru/get-started/quickstarts/insert-data-using-clickhouse-client"},{"sidebarTitle":"Создание таблиц в ClickHouse","title":"Создание таблиц в ClickHouse","href":"/ru/get-started/quickstarts/creating-tables"},{"sidebarTitle":"Выборка данных ClickHouse","title":"Выборка данных ClickHouse","href":"/ru/get-started/quickstarts/writing-queries"},{"sidebarTitle":"Создайте первую таблицу MergeTree","title":"Создайте первую таблицу MergeTree","href":"/ru/get-started/quickstarts/create-your-first-mergetree-table"}]},{"group":"Аналитика в реальном времени","expanded":false,"pages":[{"sidebarTitle":"Создайте свое первое materialized view","title":"Создайте свое первое materialized view","href":"/ru/get-started/quickstarts/create-your-first-materialized-view"},{"sidebarTitle":"Создайте первую проекцию","title":"Создайте первую проекцию","href":"/ru/get-started/quickstarts/create-your-first-projection"}]},{"group":"Хранилище данных","expanded":false,"pages":[{"sidebarTitle":"Как подключить каталог Iceberg в ClickHouse Cloud","title":"Как подключить каталог Iceberg в ClickHouse Cloud","href":"/ru/get-started/quickstarts/connect-your-iceberg-catalog"},{"sidebarTitle":"Обновление и удаление данных ClickHouse","title":"Обновление и удаление данных ClickHouse","description":"Описывает, как выполнять операции обновления и удаления в ClickHouse","href":"/ru/get-started/quickstarts/mutations"}]},{"group":"Обсервабилити","expanded":false,"pages":[{"sidebarTitle":"Работа с типом Map в ClickHouse","title":"Работа с типом Map в ClickHouse","href":"/ru/get-started/quickstarts/working-with-the-map-type"}]}]},{"group":"Introduction","expanded":true,"pages":[{"sidebarTitle":"Что такое ClickHouse?","description":"ClickHouse® — это столбцовая система управления базами данных SQL (СУБД) для онлайн-аналитической обработки (OLAP). Она доступна как в виде программного обеспечения с открытым исходным кодом, так и в виде облачного сервиса.","title":"Что такое ClickHouse?","href":"/ru/get-started/about/intro"},{"sidebarTitle":"Почему ClickHouse такой быстрый?","title":"Почему ClickHouse такой быстрый?","href":"/ru/get-started/about/why-clickhouse-is-so-fast"},{"sidebarTitle":"Почему ClickHouse уникален?","title":"Отличительные особенности ClickHouse","href":"/ru/get-started/about/distinctive-features"}]},{"group":"Use cases","expanded":true,"pages":[{"title":"Сценарии использования","sidebarTitle":"Обзор","href":"/ru/get-started/use-cases/overview"},{"title":"Real-time аналитика","sidebarTitle":"Real-time аналитика","href":"/ru/get-started/use-cases/real-time-analytics"},{"title":"Обсервабилити","sidebarTitle":"Обсервабилити","href":"/ru/get-started/use-cases/observability"},{"title":"Хранилище данных","sidebarTitle":"Хранилище данных","href":"/ru/get-started/use-cases/data-warehousing"},{"title":"Агентная аналитика","sidebarTitle":"Агентная аналитика","href":"/ru/get-started/use-cases/agentic-analytics"}]},{"sidebarTitle":"Режимы развертывания","title":"Режимы развертывания","href":"/ru/get-started/about/deployment-modes"}]},{"group":"Setup","icon":"/images/menu-icon-gear.svg","expanded":true,"pages":[{"sidebarTitle":"Установка","title":"Инструкция по установке","href":"/ru/get-started/setup/install"},{"sidebarTitle":"Быстрый старт в Cloud","title":"Быстрый старт с ClickHouse Cloud","href":"/ru/get-started/setup/cloud"},{"group":"Self-managed","expanded":true,"pages":[{"title":"Установка в самоуправляемой среде","sidebarTitle":"Обзор","href":"/ru/get-started/setup/self-managed/overview"},{"group":"Local development","pages":[{"sidebarTitle":"Быстрая установка","title":"Быстрая установка","href":"/ru/get-started/setup/self-managed/quick-install"},{"sidebarTitle":"clickhousectl (CLI)","title":"Установка с помощью ClickHouse CLI","href":"/ru/get-started/setup/self-managed/clickhousectl"},{"sidebarTitle":"Docker","title":"Установка ClickHouse с помощью Docker","href":"/ru/get-started/setup/self-managed/docker"},{"sidebarTitle":"Сборки из исходного кода и CI","title":"Сборки из исходного кода и CI","href":"/ru/get-started/setup/self-managed/advanced"}]},{"group":"Production server","pages":[{"sidebarTitle":"Debian/Ubuntu","title":"Установка ClickHouse в Debian/Ubuntu","href":"/ru/get-started/setup/self-managed/debian-ubuntu"},{"sidebarTitle":"Redhat/CentOS","title":"Установка ClickHouse в RPM-дистрибутивах Linux","href":"/ru/get-started/setup/self-managed/redhat"},{"sidebarTitle":"NixOS","title":"Установка ClickHouse в NixOS","href":"/ru/get-started/setup/self-managed/nixos"},{"sidebarTitle":"Другие дистрибутивы Linux","title":"Установка ClickHouse из архивов tgz","href":"/ru/get-started/setup/self-managed/other-linux"}]}]}]},{"group":"Sample datasets","icon":"/images/menu-icon-database.svg","expanded":true,"pages":[{"sidebarTitle":"Обзор","title":"Руководства и примеры наборов данных","href":"/ru/get-started/sample-datasets/index"},{"sidebarTitle":"Песочница ClickHouse","title":"Песочница ClickHouse","href":"/ru/get-started/sample-datasets/playground"},{"group":"Benchmarks","pages":[{"sidebarTitle":"бенчмарк больших данных AMPLab","title":"Бенчмарк больших данных AMPLab","href":"/ru/get-started/sample-datasets/amplab-benchmark"},{"sidebarTitle":"Бенчмарк Brown University","title":"Бенчмарк Brown University","href":"/ru/get-started/sample-datasets/brown-benchmark"},{"sidebarTitle":"Логи кликов Criteo, 1 ТБ","title":"Терабайт логов кликов от Criteo","href":"/ru/get-started/sample-datasets/criteo"},{"title":"Join Order Benchmark (JOB)","sidebarTitle":"JOB","href":"/ru/get-started/sample-datasets/job"},{"sidebarTitle":"Star Schema Benchmark","title":"Star Schema Benchmark (SSB, 2009)","href":"/ru/get-started/sample-datasets/star-schema"},{"title":"TPC-DS (2012)","sidebarTitle":"TPC-DS","href":"/ru/get-started/sample-datasets/tpcds"},{"title":"TPC-H (1999)","sidebarTitle":"TPC-H","href":"/ru/get-started/sample-datasets/tpch"}]},{"group":"Vector search \u0026 embeddings","pages":[{"sidebarTitle":"набор данных dbpedia","title":"набор данных dbpedia","href":"/ru/get-started/sample-datasets/dbpedia"},{"sidebarTitle":"Датасет для векторного поиска по Hacker News","title":"Датасет для векторного поиска по Hacker News","href":"/ru/get-started/sample-datasets/hacker-news-vector-search"},{"sidebarTitle":"Набор данных Laion-400M","title":"Набор данных Laion-400M","href":"/ru/get-started/sample-datasets/laion"},{"sidebarTitle":"Датасет LAION 5B","title":"Датасет LAION 5B","href":"/ru/get-started/sample-datasets/laion5b"}]},{"group":"Web \u0026 social analytics","pages":[{"sidebarTitle":"Отзывы покупателей Amazon","title":"Отзывы покупателей Amazon","href":"/ru/get-started/sample-datasets/amazon-reviews"},{"sidebarTitle":"Обезличенная веб-аналитика","title":"Обезличенная веб-аналитика","href":"/ru/get-started/sample-datasets/anon-web-analytics-metrica"},{"sidebarTitle":"Репозиторий GitHub","title":"Запросы в ClickHouse с использованием данных GitHub","href":"/ru/get-started/sample-datasets/github"},{"sidebarTitle":"События GitHub","title":"Набор данных о событиях GitHub","href":"/ru/get-started/sample-datasets/github-events"},{"sidebarTitle":"Hacker News","title":"Набор данных Hacker News","href":"/ru/get-started/sample-datasets/hacker-news"},{"sidebarTitle":"Stack Overflow","title":"Анализ данных Stack Overflow с помощью ClickHouse","href":"/ru/get-started/sample-datasets/stackoverflow"},{"sidebarTitle":"Дизлайки YouTube","title":"Набор данных YouTube о дизлайках","href":"/ru/get-started/sample-datasets/youtube-dislikes"}]},{"group":"Geo \u0026 location","pages":[{"sidebarTitle":"Базовые станции сотовой связи","title":"Геопространственный анализ на примере набора данных о базовых станциях сотовой связи","href":"/ru/get-started/sample-datasets/cell-towers"},{"sidebarTitle":"Foursquare OS Places","title":"Набор данных Foursquare OS Places","href":"/ru/get-started/sample-datasets/foursquare-os-places"},{"sidebarTitle":"Данные о такси Нью-Йорка","title":"Геопространственный анализ на наборе данных о такси Нью-Йорка","href":"/ru/get-started/sample-datasets/nyc-taxi"}]},{"group":"Time series \u0026 sensors","pages":[{"sidebarTitle":"Данные с экологических датчиков","title":"Данные с экологических датчиков","href":"/ru/get-started/sample-datasets/environmental-sensors"},{"sidebarTitle":"NOAA Global Historical Climatology Network ","title":"NOAA Global Historical Climatology Network","href":"/ru/get-started/sample-datasets/noaa"},{"sidebarTitle":"Исторические датасеты о погоде Тайваня","title":"Исторические датасеты о погоде Тайваня","href":"/ru/get-started/sample-datasets/tw-weather"},{"sidebarTitle":"WikiStat","title":"WikiStat","href":"/ru/get-started/sample-datasets/wikistat"}]},{"group":"Public records \u0026 open data","pages":[{"sidebarTitle":"Открытые данные COVID-19","title":"Открытые данные COVID-19","href":"/ru/get-started/sample-datasets/covid19"},{"sidebarTitle":"Набор данных New York Public Library \"what's on the menu?\"","title":"Набор данных New York Public Library \"What's on the Menu?\"","href":"/ru/get-started/sample-datasets/menus"},{"sidebarTitle":"Данные о жалобах NYPD","title":"Данные о жалобах NYPD","href":"/ru/get-started/sample-datasets/nypd-complaint-data"},{"sidebarTitle":"Данные OnTime об авиарейсах","title":"OnTime","href":"/ru/get-started/sample-datasets/ontime"},{"sidebarTitle":"Цены на недвижимость в Великобритании","title":"Аналитические запросы к данным о ценах на недвижимость в Великобритании","href":"/ru/get-started/sample-datasets/uk-price-paid"}]}]},{"group":"Migrate","icon":"/images/caret-double-right.svg","expanded":true,"pages":[{"sidebarTitle":"Обзор","title":"Перенос данных в ClickHouse","href":"/ru/get-started/migrate/overview"},{"group":"PostgreSQL","pages":[{"title":"Сравнение PostgreSQL и ClickHouse","sidebarTitle":"Обзор","href":"/ru/get-started/migrate/postgres/overview"},{"group":"Migration guide","pages":[{"title":"Миграция данных","sidebarTitle":"Часть 1","href":"/ru/get-started/migrate/postgres/migration-guide/migration-guide-part1"},{"title":"Переписывание запросов PostgreSQL","sidebarTitle":"Часть 2","href":"/ru/get-started/migrate/postgres/migration-guide/migration-guide-part2"},{"title":"Приёмы моделирования данных","sidebarTitle":"Часть 3","href":"/ru/get-started/migrate/postgres/migration-guide/migration-guide-part3"}]},{"title":"Приложение","href":"/ru/get-started/migrate/postgres/appendix"}]},{"group":"BigQuery","pages":[{"title":"Сравнение BigQuery и ClickHouse Cloud","sidebarTitle":"Обзор","href":"/ru/get-started/migrate/bigquery/overview"},{"title":"Миграция из BigQuery в ClickHouse Cloud","sidebarTitle":"Руководство по миграции","href":"/ru/get-started/migrate/bigquery/migrating-to-clickhouse-cloud"},{"sidebarTitle":"Загрузка данных","title":"Загрузка данных из BigQuery в ClickHouse","href":"/ru/get-started/migrate/bigquery/loading-data"}]},{"group":"Snowflake","pages":[{"sidebarTitle":"Обзор","title":"Миграция из Snowflake в ClickHouse","href":"/ru/get-started/migrate/snowflake/overview"},{"sidebarTitle":"Руководство по миграции","title":"Миграция из Snowflake в ClickHouse","href":"/ru/get-started/migrate/snowflake/migration-guide"},{"sidebarTitle":"Справочник по переводу SQL","title":"Переход с Snowflake на ClickHouse","href":"/ru/get-started/migrate/snowflake/sql-translation-reference"}]},{"group":"Elasticsearch","pages":[{"sidebarTitle":"Обзор","title":"Миграция с Elasticsearch на ClickHouse","href":"/ru/get-started/migrate/elastic/overview"}]},{"group":"Redshift","pages":[{"sidebarTitle":"Обзор","title":"Сравнение ClickHouse Cloud и Amazon Redshift","href":"/ru/get-started/migrate/redshift/overview"},{"sidebarTitle":"Руководство по миграции","title":"Руководство по миграции с Amazon Redshift в ClickHouse","href":"/ru/get-started/migrate/redshift/migration-guide"},{"sidebarTitle":"Справочник по переводу SQL","title":"Руководство по переводу SQL из Amazon Redshift в ClickHouse","href":"/ru/get-started/migrate/redshift/sql-translation-reference"}]},{"group":"OSS to Cloud","pages":[{"sidebarTitle":"Использование remoteSecure","title":"Миграция между самоуправляемым ClickHouse и ClickHouse Cloud с помощью remoteSecure","href":"/ru/get-started/migrate/oss-to-cloud/clickhouse-to-cloud"},{"sidebarTitle":"Использование BACKUP и RESTORE","title":"Миграция из самоуправляемого ClickHouse в ClickHouse Cloud с помощью команд BACKUP","href":"/ru/get-started/migrate/oss-to-cloud/oss-to-cloud-backup-restore"}]},{"group":"Other methods","pages":[{"sidebarTitle":"Использование clickhouse-local","title":"Миграция в ClickHouse с использованием clickhouse-local","href":"/ru/get-started/migrate/other-methods/clickhouse-local-etl"},{"sidebarTitle":"Использование стороннего ETL-инструмента","title":"Использование стороннего ETL-инструмента","href":"/ru/get-started/migrate/other-methods/etl-tool-to-clickhouse"},{"title":"Перенос данных из облачного объектного хранилища в ClickHouse Cloud","href":"/ru/get-started/migrate/other-methods/object-storage-to-clickhouse"}]}]}]},{"item":"Основные понятия","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-concepts.svg","pages":[{"title":"Основные понятия","href":"/ru/concepts"}]},{"item":"Руководства","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-guides.svg","pages":[{"title":"Руководства","href":"/ru/guides/clickhouse"}]},{"item":"Справочник","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-reference.svg","pages":[{"title":"Справочник","href":"/ru/reference/home"}]}]},{"tab":"Решения","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":"/ru/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":"/ru/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":"С открытым исходным кодом","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":"/ru/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":"/ru/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":"/ru/chdb"}]},{"item":"Оператор Kubernetes","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-kubernetes-operator.svg","pages":[{"title":"Оператор Kubernetes","href":"/ru/products/kubernetes-operator/overview"}]}],"pages":[{"title":"Решения","href":"/ru/products/cloud/getting-started/cloud-get-started"}]},{"tab":"Интеграции","menu":[{"item":"Экосистема","pages":[{"title":"Экосистема","href":"/ru/integrations/home"}]},{"item":"ClickPipes","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-clickpipes.svg","pages":[{"title":"ClickPipes","href":"/ru/integrations/clickpipes/home"}]},{"item":"Клиентские библиотеки для языков программирования","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-language-clients.svg","pages":[{"title":"Клиентские библиотеки для языков программирования","href":"/ru/integrations/language-clients"}]},{"item":"Коннекторы","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-connectors.svg","pages":[{"title":"Коннекторы","href":"/ru/integrations/connectors/data-sources"}]}],"pages":[{"title":"Интеграции","href":"/ru/integrations/home"}]},{"tab":"Ресурсы","menu":[{"item":"Центр поддержки","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-support-center.svg","pages":[{"title":"Центр поддержки","href":"/ru/resources/support-center/home"}]},{"item":"Разработка и участие в проекте","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-contribute.svg","pages":[{"title":"Разработка и участие в проекте","href":"/ru/resources/develop-contribute/introduction/developer-instruction"}]},{"item":"Журналы изменений","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":"/ru/resources/changelogs/cloud"}]},{"dropdown":"С открытым исходным кодом","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-server.svg","pages":[{"title":"С открытым исходным кодом","href":"/ru/resources/changelogs/oss/2026"}]}]},{"item":"О проекте","icon":"https://mintlify.s3.us-west-1.amazonaws.com/private-7c7dfe99/images/icons/icon-about.svg","pages":[{"title":"О проекте","href":"/ru/resources/about"}]}],"pages":[{"title":"Ресурсы","href":"/ru/resources/support-center/home"}]}]},{"language":"zh","pages":[{"title":"zh","href":"/zh/get-started/quickstarts/working-with-the-map-type"}]}]},"basePath":"","title":"Работа с типом Map в ClickHouse - ClickHouse Documentation","buildId":"dpl_Acry4NrQAgjcikyFgVE2eJ7XQCAv","deploymentId":"dpl_Acry4NrQAgjcikyFgVE2eJ7XQCAv","dynamics":["07c022d89b"],"chunks":["Frame-D9VvKFqQ.js","DynamicMarkdown-BCpKo5ib.js"]}