ClickHouse/tests/performance/asof.xml

30 lines
638 B
XML
Raw Normal View History

2022-02-18 16:37:24 +00:00
<test>
<preconditions>
<table_exists>test.hits</table_exists>
</preconditions>
<query>
SELECT *
FROM
(
SELECT
RegionID,
toDateTime(EventDate) AS date,
count() AS quantity
FROM test.hits
GROUP BY
RegionID,
date
) AS regions
ASOF LEFT JOIN
(
SELECT
RegionID,
EventTime
FROM test.hits
) AS ids ON (regions.RegionID = ids.RegionID) AND (regions.date &lt; ids.EventTime)
</query>
</test>