mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
40 lines
672 B
MySQL
40 lines
672 B
MySQL
|
DROP TABLE IF EXISTS LOG_T;
|
||
|
|
||
|
CREATE TABLE LOG_T
|
||
|
(
|
||
|
`fingerprint` UInt64,
|
||
|
`fields` Nested(
|
||
|
name LowCardinality(String),
|
||
|
value String)
|
||
|
)
|
||
|
ENGINE = MergeTree
|
||
|
ORDER BY fingerprint;
|
||
|
|
||
|
SELECT
|
||
|
fields.name,
|
||
|
fields.value
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
fields.name,
|
||
|
fields.value
|
||
|
FROM LOG_T
|
||
|
)
|
||
|
WHERE has(['node'], fields.value[indexOf(fields.name, 'ProcessName')]);
|
||
|
|
||
|
INSERT INTO LOG_T VALUES (123, ['Hello', 'ProcessName'], ['World', 'node']);
|
||
|
|
||
|
SELECT
|
||
|
fields.name,
|
||
|
fields.value
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
fields.name,
|
||
|
fields.value
|
||
|
FROM LOG_T
|
||
|
)
|
||
|
WHERE has(['node'], fields.value[indexOf(fields.name, 'ProcessName')]);
|
||
|
|
||
|
DROP TABLE LOG_T;
|