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:
Nikita Mikhaylov 2024-08-25 13:33:22 +00:00 committed by GitHub
commit a075842b90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
0 0 0

View 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