IF NOT EXISTS test (
event_date DEFAULT toDate('2019-09-20'),
id UInt64 DEFAULT 0,
ver UInt8 DEFAULT 0
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(event_date)
ORDER BY (id)
SETTINGS index_granularity=256
INSERT INTO test (id,ver) VALUES (1,0)(1,0)(1,0)(1,1)(1,2)(2,0)(2,0)(2,1)(2,2)
SELECT * FROM test
CREATE TABLE IF NOT EXISTS max_versions_test
ENGINE = Join(ANY, INNER, id, ver)
AS SELECT id, MAX(ver) AS ver
FROM test
GROUP BY id;
SELECT *
FROM test
ANY JOIN max_versions_test
USING (id, ver)
SETTINGS any_join_distinct_right_table_keys=1;
19.5 , ваш пример у меня тоже не работает. баг
Обсуждают сегодня