Increase amount of rows in requests for partial result tests

This commit is contained in:
alexX512 2023-09-09 10:11:10 +00:00
parent 2e2e226e1d
commit 54bc3fea9a
5 changed files with 44 additions and 32 deletions

View File

@ -76,7 +76,13 @@ public:
void setRowsBeforeLimitCounter(RowsBeforeLimitCounterPtr counter) override { rows_before_limit_at_least.swap(counter); }
void setInputPortHasCounter(size_t pos) { ports_data[pos].input_port_has_counter = true; }
PartialResultStatus getPartialResultProcessorSupportStatus() const override { return PartialResultStatus::FullSupported; }
PartialResultStatus getPartialResultProcessorSupportStatus() const override
{
/// Currently LimitPartialResultTransform support only single-thread work.
bool is_partial_result_supported = inputs.size() == 1 && outputs.size() == 1;
return is_partial_result_supported ? PartialResultStatus::FullSupported : PartialResultStatus::NotSupported;
}
};
}

View File

@ -64,27 +64,29 @@ def run_query_without_errors(query, support_partial_result):
def main():
rows_number = 2e7 + 1
# Request with partial result limit less then full limit
run_query_without_errors(
"SELECT number FROM numbers_mt(5e6+1) ORDER BY -number LIMIT 5 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 3",
f"SELECT number FROM numbers_mt({rows_number}) ORDER BY -number LIMIT 5 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 3",
support_partial_result=True,
)
# Request with partial result limit greater then full limit
run_query_without_errors(
"SELECT number FROM numbers_mt(5e6+1) ORDER BY -number LIMIT 3 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
f"SELECT number FROM numbers_mt({rows_number}) ORDER BY -number LIMIT 3 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
support_partial_result=True,
)
# Request with OFFSET
run_query_without_errors(
"SELECT number FROM numbers_mt(5e6+1) ORDER BY -number LIMIT 3 OFFSET 1 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
f"SELECT number FROM numbers_mt({rows_number}) ORDER BY -number LIMIT 3 OFFSET 1 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
support_partial_result=True,
)
# Request with OFFSET greater then partial result limit (partial result pipeline use blocks with less then OFFSET, so there will be no elements in block after LimitPartialResultTransform)
run_query_without_errors(
"SELECT number FROM numbers_mt(5e6+1) ORDER BY -number LIMIT 3 OFFSET 15 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
f"SELECT number FROM numbers_mt({rows_number}) ORDER BY -number LIMIT 3 OFFSET 15 SETTINGS max_threads = 1, partial_result_update_duration_ms = 1, max_rows_in_partial_result = 5",
support_partial_result=False,
)

View File

@ -4,35 +4,35 @@ Rows 3 Columns 1
Column number type UInt64
Rows 5 Columns 1
Column number type UInt64
5000000
4999999
4999998
4999997
4999996
20000000
19999999
19999998
19999997
19999996
Rows 0 Columns 1
Column number type UInt64
Rows 3 Columns 1
Column number type UInt64
Rows 3 Columns 1
Column number type UInt64
5000000
4999999
4999998
20000000
19999999
19999998
Rows 0 Columns 1
Column number type UInt64
Rows 3 Columns 1
Column number type UInt64
Rows 3 Columns 1
Column number type UInt64
4999999
4999998
4999997
19999999
19999998
19999997
Rows 0 Columns 1
Column number type UInt64
Rows 0 Columns 1
Column number type UInt64
Rows 3 Columns 1
Column number type UInt64
4999985
4999984
4999983
19999985
19999984
19999983

View File

@ -82,8 +82,10 @@ def run_query_without_errors(
def supported_scenarios_without_key():
rows_number = 2e7 + 1
# Simple aggregation query
query = "select median(number), stddevSamp(number), stddevPop(number), max(number), min(number), any(number), count(number), avg(number), sum(number) from numbers_mt(1e7+1) settings max_threads = 1, partial_result_update_duration_ms = 1"
query = f"select median(number), stddevSamp(number), stddevPop(number), max(number), min(number), any(number), count(number), avg(number), sum(number) from numbers_mt({rows_number}) settings max_threads = 1, partial_result_update_duration_ms = 1"
invariants = {
"median(number)": lambda old_value, new_value: old_value <= new_value,
"max(number)": lambda old_value, new_value: old_value <= new_value,
@ -97,7 +99,7 @@ def supported_scenarios_without_key():
)
# Aggregation query with a nested ORDER BY subquery
query = "select median(number), stddevSamp(number), stddevPop(number), max(number), min(number), any(number), count(number), avg(number), sum(number) FROM (SELECT number FROM numbers_mt(1e7) ORDER BY -number LIMIT 3) settings max_threads = 1, partial_result_update_duration_ms=1"
query = f"select median(number), stddevSamp(number), stddevPop(number), max(number), min(number), any(number), count(number), avg(number), sum(number) FROM (SELECT number FROM numbers_mt({rows_number}) ORDER BY -number LIMIT 3) settings max_threads = 1, partial_result_update_duration_ms=1"
# Aggregation receives small partial result blocks from ORDER BY which always sends blocks with bigger values
invariants["min(number)"] = lambda old_value, new_value: old_value <= new_value
@ -107,12 +109,14 @@ def supported_scenarios_without_key():
def unsupported_scenarios():
rows_number = 2e7 + 1
# Currently aggregator for partial result supports only single thread aggregation without key
# Update test when multithreading or aggregation with GROUP BY will be supported for partial result updates
multithread_query = "select sum(number) from numbers_mt(1e7+1) settings max_threads = 2, partial_result_update_duration_ms = 100"
multithread_query = f"select sum(number) from numbers_mt({rows_number}) settings max_threads = 2, partial_result_update_duration_ms = 100"
run_query_without_errors(multithread_query, support_partial_result=False)
group_with_key_query = "select mod2, sum(number) from numbers_mt(1e7+1) group by number % 2 as mod2 settings max_threads = 1, partial_result_update_duration_ms = 100"
group_with_key_query = f"select mod2, sum(number) from numbers_mt({rows_number}) group by number % 2 as mod2 settings max_threads = 1, partial_result_update_duration_ms = 100"
run_query_without_errors(group_with_key_query, support_partial_result=False)

View File

@ -28,11 +28,11 @@ Column any(number) type UInt64
Column count(number) type UInt64
Column avg(number) type Float64
Column sum(number) type UInt64
max(number) [10000000]
max(number) [20000000]
min(number) [0]
any(number) [0]
count(number) [10000001]
sum(number) [50000005000000]
count(number) [20000001]
sum(number) [200000010000000]
Rows 0 Columns 9
Column median(number) type Float64
Column stddevSamp(number) type Float64
@ -63,18 +63,18 @@ Column any(number) type UInt64
Column count(number) type UInt64
Column avg(number) type Float64
Column sum(number) type UInt64
max(number) [9999999]
min(number) [9999997]
any(number) [9999999]
max(number) [20000000]
min(number) [19999998]
any(number) [20000000]
count(number) [3]
sum(number) [29999994]
sum(number) [59999997]
Rows 0 Columns 1
Column sum(number) type UInt64
Rows 0 Columns 1
Column sum(number) type UInt64
Rows 1 Columns 1
Column sum(number) type UInt64
sum(number) [50000005000000]
sum(number) [200000010000000]
Rows 0 Columns 2
Column mod2 type UInt8
Column sum(number) type UInt64
@ -85,4 +85,4 @@ Rows 2 Columns 2
Column mod2 type UInt8
Column sum(number) type UInt64
mod2 [0, 1]
sum(number) [25000005000000, 25000000000000]
sum(number) [100000010000000, 100000000000000]