mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #68772 from ClickHouse/reduce-time-of-01395_limit_more_cases
Split test case and reduce number of random runs to reduce the time necessary to run the test
This commit is contained in:
commit
a075842b90
@ -254,4 +254,3 @@
|
||||
15 13 0 0 0 0 0 0
|
||||
15 14 0 0 0 0 0 0
|
||||
15 15 0 0 0 0 0 0
|
||||
0 0 0
|
||||
|
@ -9,8 +9,11 @@ SIZE=13
|
||||
for OFFSET in {0..15}; do
|
||||
for LIMIT in {0..15}; do
|
||||
echo "SELECT
|
||||
$OFFSET, $LIMIT,
|
||||
count() AS c, min(number) AS first, max(number) AS last,
|
||||
$OFFSET,
|
||||
$LIMIT,
|
||||
count() AS c,
|
||||
min(number) AS first,
|
||||
max(number) AS last,
|
||||
throwIf(first != ($OFFSET < $SIZE AND $LIMIT > 0 ? $OFFSET : 0)),
|
||||
throwIf(last != ($OFFSET < $SIZE AND $LIMIT > 0 ? least($SIZE - 1, $OFFSET + $LIMIT - 1) : 0)),
|
||||
throwIf((c != 0 OR first != 0 OR last != 0) AND (c != last - first + 1))
|
||||
@ -18,20 +21,3 @@ for OFFSET in {0..15}; do
|
||||
"
|
||||
done
|
||||
done | $CLICKHOUSE_CLIENT -n --max_block_size 5
|
||||
|
||||
# Randomized test
|
||||
|
||||
ITERATIONS=1000
|
||||
for _ in $(seq $ITERATIONS); do
|
||||
SIZE=$(($RANDOM % 100))
|
||||
OFFSET=$(($RANDOM % 111))
|
||||
LIMIT=$(($RANDOM % 111))
|
||||
|
||||
echo "WITH count() AS c, min(number) AS first, max(number) AS last
|
||||
SELECT
|
||||
throwIf(first != ($OFFSET < $SIZE AND $LIMIT > 0 ? $OFFSET : 0)),
|
||||
throwIf(last != ($OFFSET < $SIZE AND $LIMIT > 0 ? least($SIZE - 1, $OFFSET + $LIMIT - 1) : 0)),
|
||||
throwIf((c != 0 OR first != 0 OR last != 0) AND (c != last - first + 1))
|
||||
FROM (SELECT * FROM numbers($SIZE) LIMIT $OFFSET, $LIMIT);
|
||||
"
|
||||
done | $CLICKHOUSE_CLIENT -n --max_block_size $(($RANDOM % 20 + 1)) | uniq
|
||||
|
@ -0,0 +1 @@
|
||||
0 0 0
|
22
tests/queries/0_stateless/01395_limit_more_cases_random.sh
Executable file
22
tests/queries/0_stateless/01395_limit_more_cases_random.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: no-fasttest
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
SIZE=13
|
||||
ITERATIONS=300
|
||||
for _ in $(seq $ITERATIONS); do
|
||||
SIZE=$(($RANDOM % 100))
|
||||
OFFSET=$(($RANDOM % 111))
|
||||
LIMIT=$(($RANDOM % 111))
|
||||
|
||||
echo "WITH count() AS c, min(number) AS first, max(number) AS last
|
||||
SELECT
|
||||
throwIf(first != ($OFFSET < $SIZE AND $LIMIT > 0 ? $OFFSET : 0)),
|
||||
throwIf(last != ($OFFSET < $SIZE AND $LIMIT > 0 ? least($SIZE - 1, $OFFSET + $LIMIT - 1) : 0)),
|
||||
throwIf((c != 0 OR first != 0 OR last != 0) AND (c != last - first + 1))
|
||||
FROM (SELECT * FROM numbers($SIZE) LIMIT $OFFSET, $LIMIT);
|
||||
"
|
||||
done | $CLICKHOUSE_CLIENT -n --max_block_size $(($RANDOM % 20 + 1)) | uniq
|
Loading…
Reference in New Issue
Block a user