mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix a bug and add some tests
This commit is contained in:
parent
6e40b9fb6c
commit
c18749a704
@ -44,6 +44,7 @@ parser.add_argument('--port', nargs='*', default=[9000], help="Space-separated l
|
||||
parser.add_argument('--runs', type=int, default=1, help='Number of query runs per server.')
|
||||
parser.add_argument('--max-queries', type=int, default=None, help='Test no more than this number of queries, chosen at random.')
|
||||
parser.add_argument('--queries-to-run', nargs='*', type=int, default=None, help='Space-separated list of indexes of queries to test.')
|
||||
parser.add_argument('--max-query-seconds', type=int, default=10, help='For how many seconds at most a query is allowed to run. The script finishes with error if this time is exceeded.')
|
||||
parser.add_argument('--profile-seconds', type=int, default=0, help='For how many seconds to profile a query for which the performance has changed.')
|
||||
parser.add_argument('--long', action='store_true', help='Do not skip the tests tagged as long.')
|
||||
parser.add_argument('--print-queries', action='store_true', help='Print test queries and exit.')
|
||||
@ -323,7 +324,7 @@ for query_index in queries_to_run:
|
||||
server_seconds += elapsed
|
||||
print(f'query\t{query_index}\t{run_id}\t{conn_index}\t{elapsed}')
|
||||
|
||||
if elapsed > 10:
|
||||
if elapsed > args.max_query_seconds:
|
||||
# Stop processing pathologically slow queries, to avoid timing out
|
||||
# the entire test task. This shouldn't really happen, so we don't
|
||||
# need much handling for this case and can just exit.
|
||||
|
@ -667,8 +667,6 @@ static bool tryParseFrameDefinition(ASTWindowDefinition * node, IParser::Pos & p
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
|
||||
"Frame end UNBOUNDED PRECEDING is not implemented");
|
||||
}
|
||||
|
||||
node->frame.end_offset = -node->frame.end_offset;
|
||||
}
|
||||
else if (keyword_following.ignore(pos, expected))
|
||||
{
|
||||
|
@ -386,6 +386,7 @@ void WindowTransform::advanceFrameStartRangeOffset()
|
||||
#define APPLY_FOR_ONE_TYPE(FUNCTION, TYPE) \
|
||||
else if (typeid_cast<const TYPE *>(column)) \
|
||||
{ \
|
||||
/* NOLINT clang-tidy you're dumb, I can't put FUNCTION in braces here. */ \
|
||||
FUNCTION<TYPE>(); \
|
||||
}
|
||||
|
||||
|
@ -59,4 +59,31 @@
|
||||
format Null
|
||||
]]></query>
|
||||
|
||||
<!--
|
||||
Rows from the hottest 21-second intervals, to test the RANGE OFFSET frame.
|
||||
-->
|
||||
<query>
|
||||
SELECT * FROM
|
||||
(SELECT EventTime,
|
||||
count(*) OVER (ORDER BY EventTime ASC
|
||||
RANGE BETWEEN 10 PRECEDING AND 10 FOLLOWING) AS c
|
||||
FROM hits_10m_single)
|
||||
FORMAT Null
|
||||
</query>
|
||||
|
||||
<!--
|
||||
This is kind of the same, except the following frame boundary is not
|
||||
inclusive. Should be much faster, because we don't have to reset the
|
||||
aggregation state. After we support subtraction of aggregate state, the
|
||||
above query should become closer in performance to this one.
|
||||
-->
|
||||
<query>
|
||||
select * from
|
||||
(select EventTime,
|
||||
count(*) over (partition by
|
||||
floor((toUInt32(EventTime) + 10 + 1) / 20)) as c
|
||||
from hits_10m_single)
|
||||
format Null
|
||||
</query>
|
||||
|
||||
</test>
|
||||
|
@ -820,3 +820,19 @@ settings max_block_size = 3;
|
||||
8 6 10 5
|
||||
9 7 10 4
|
||||
10 8 10 3
|
||||
select x, min(x) over w, max(x) over w, count(x) over w from (
|
||||
select toUInt8(number) x from numbers(11)) t
|
||||
window w as (order by x desc range between unbounded preceding and 2 preceding)
|
||||
order by x
|
||||
settings max_block_size = 4;
|
||||
0 2 10 9
|
||||
1 3 10 8
|
||||
2 4 10 7
|
||||
3 5 10 6
|
||||
4 6 10 5
|
||||
5 7 10 4
|
||||
6 8 10 3
|
||||
7 9 10 2
|
||||
8 10 10 1
|
||||
9 0 0 0
|
||||
10 0 0 0
|
||||
|
@ -260,3 +260,9 @@ select x, min(x) over w, max(x) over w, count(x) over w from (
|
||||
window w as (order by x desc range between unbounded preceding and 2 following)
|
||||
order by x
|
||||
settings max_block_size = 3;
|
||||
|
||||
select x, min(x) over w, max(x) over w, count(x) over w from (
|
||||
select toUInt8(number) x from numbers(11)) t
|
||||
window w as (order by x desc range between unbounded preceding and 2 preceding)
|
||||
order by x
|
||||
settings max_block_size = 4;
|
||||
|
Loading…
Reference in New Issue
Block a user