Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions docker/otel-collector/schema/seed/00006_otel_logs_rollups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,6 @@ GROUP BY ColumnIdentifier, Key, Timestamp;
-- Single MV: CTE with UNION ALL across all columns, then aggregate
Comment thread
knudtty marked this conversation as resolved.
Resolved
CREATE MATERIALIZED VIEW IF NOT EXISTS ${DATABASE}.otel_logs_attr_kv_rollup_15m_mv TO ${DATABASE}.otel_logs_kv_rollup_15m
AS WITH elements AS (
SELECT
'ResourceAttributes' AS ColumnIdentifier,
toStartOfFifteenMinutes(Timestamp) AS Timestamp,
replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key,
CAST(entry.2 AS String) AS Value
FROM ${DATABASE}.otel_logs
ARRAY JOIN ResourceAttributes AS entry
UNION ALL
SELECT
'LogAttributes' AS ColumnIdentifier,
toStartOfFifteenMinutes(Timestamp) AS Timestamp,
replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key,
CAST(entry.2 AS String) AS Value
FROM ${DATABASE}.otel_logs
ARRAY JOIN LogAttributes AS entry
UNION ALL
SELECT
'ScopeAttributes' AS ColumnIdentifier,
toStartOfFifteenMinutes(Timestamp) AS Timestamp,
replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key,
CAST(entry.2 AS String) AS Value
FROM ${DATABASE}.otel_logs
ARRAY JOIN ScopeAttributes AS entry
UNION ALL
SELECT
'NativeColumn' AS ColumnIdentifier,
toStartOfFifteenMinutes(Timestamp) AS Timestamp,
Expand Down
22 changes: 22 additions & 0 deletions packages/common-utils/src/__tests__/clickhouseVersion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
isClickHouseVersionAtLeast,
parseClickHouseVersion,
supportsDirectReadMap,
supportsMergeTreeTextIndex,
} from '@/core/clickhouseVersion';

type ClickHouseVersionTuple = readonly [number, number, number, number];
Expand Down Expand Up @@ -174,3 +175,24 @@ describe('supportsDirectReadMap', () => {
expect(supportsDirectReadMap(undefined)).toBe(false);
});
});

describe('supportsMergeTreeTextIndex', () => {
it.each<readonly [ClickHouseVersionTuple, boolean]>([
[[26, 3, 0, 0], true],
[[26, 3, 0, 1], true],
[[26, 3, 99, 99], true],
[[26, 4, 0, 0], true],
[[27, 0, 0, 0], true],
[[26, 2, 99, 99], false],
[[26, 2, 0, 0], false],
[[26, 1, 0, 0], false],
[[25, 12, 0, 0], false],
[[24, 0, 0, 0], false],
])('%j → %s', (version, expected) => {
expect(supportsMergeTreeTextIndex(version)).toBe(expected);
});

it('returns false when the version is undefined', () => {
expect(supportsMergeTreeTextIndex(undefined)).toBe(false);
});
});
Loading