ClickHouse/tests/performance/sequence_match.xml

80 lines
3.1 KiB
XML

<test>
<preconditions>
<table_exists>hits_10m_single</table_exists>
<table_exists>test.hits</table_exists>
</preconditions>
<!-- Queries with some matching rows -->
<query>
SELECT 1 FROM hits_10m_single GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age BETWEEN 20 AND 30, Age BETWEEN 35 AND 50)
FORMAT Null
</query>
<query>
SELECT 1 FROM test.hits GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age BETWEEN 20 AND 30, Age BETWEEN 35 AND 50)
FORMAT Null
</query>
<!-- Same queries as above, but with all rows matching the last condition -->
<query>
SELECT 1 FROM hits_10m_single GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age BETWEEN 20 AND 30, Age BETWEEN 35 AND 50, Age >= 0)
FORMAT Null
</query>
<query>
SELECT 1 FROM test.hits GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age BETWEEN 20 AND 30, Age BETWEEN 35 AND 50, Age >= 0)
FORMAT Null
</query>
<!-- Queries with no rows matching (Age is never negative) -->
<query>
SELECT 1 FROM hits_10m_single GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age >= 0, Age = -1)
FORMAT Null
</query>
<query>
SELECT 1 FROM test.hits GROUP BY EventTime HAVING
sequenceMatch('(?1)(?t&lt;1)(?2)')(
EventTime, Age >= 0, Age = -1)
FORMAT Null
</query>
<!-- Using array conditions in further tests (only available for test.hits) for good diversity of matched rows percentage -->
<!-- Queries with time constraints -->
<query>
SELECT 1 FROM test.hits WHERE RefererCategories != [] GROUP BY ClientIP, RequestNum HAVING
sequenceMatch('(?1)(?t&gt;1000)(?3)')(
EventTime, hasAny(RefererCategories, [9]), hasAny(RefererCategories, [3849, 2, 3, 4, 5, 6, 7]), hasAll(RefererCategories, [1, 9]), hasAny(RefererCategories, [1, 2326, 5496]))
FORMAT Null
</query>
<query>
SELECT 1 FROM test.hits WHERE RefererCategories != [] GROUP BY ClientIP, RequestNum HAVING
sequenceMatch('(?1)(?t&lt;10000)(?2)')(
EventTime, hasAny(RefererCategories, [3849, 2, 3, 4, 5, 6, 7]), hasAny(RefererCategories, [1, 2]))
FORMAT Null
</query>
<!-- Queries without time constraints -->
<query>
SELECT 1 FROM test.hits WHERE RefererCategories != [] GROUP BY ClientIP, RequestNum HAVING
sequenceMatch('(?1)(?3)(?1)(?3)')(
EventTime, hasAny(RefererCategories, [9]), hasAny(RefererCategories, [3849, 2, 3, 4, 5, 6, 7]), hasAll(RefererCategories, [1, 9]), hasAny(RefererCategories, [1, 2326, 5496]))
FORMAT Null
</query>
<query>
SELECT 1 FROM test.hits WHERE RefererCategories != [] GROUP BY ClientIP, RequestNum HAVING
sequenceMatch('(?1)(?2)(?1)(?2)(?1)')(
EventTime, hasAny(RefererCategories, [3849, 2, 3, 4, 5, 6, 7]), hasAny(RefererCategories, [1, 2]))
FORMAT Null
</query>
</test>