Skip to content

Commit 9086f55

Browse files
committed
increase the number of rows to fetch from Trino
1 parent d220ea4 commit 9086f55

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

tests/templates/kuttl/client-spooling/04_query.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,26 @@ def get_connection(coordinator):
4040

4141
# The table tpch.sf100.customer has 15 million rows but Python consumes
4242
# too much memory to retrieve all of them at once.
43-
# Fetching them one by one is too slow, so we fetch only 10k rows which seems to be enough
43+
# Fetching them one by one is too slow, so we fetch enough rows
4444
# for Trino to use the spooling protocol.
45-
# Fetching less rows is too risky IMO as Trino might decide to not use spooling.
45+
# Fetching too few rows is risky as Trino might decide to not use spooling.
4646

4747
print("🚜 fetching many rows from Trino to trigger spooling...")
4848

49-
cursor.execute("SELECT * FROM tpch.sf100.customer")
5049
customer_count = 0
51-
batch = 10
52-
while batch > 0:
53-
print(f"⏳ fetching batch {batch} of 1000 rows...")
54-
cursor.fetchmany(1_000)
55-
customer_count += 1_000
56-
batch = batch - 1
57-
58-
assert customer_count == 10_000, (
59-
f"💀 crap! expected 10_000 customers, got {customer_count}"
50+
batch_count = 50
51+
batch_size = 1_000
52+
expected_customers = batch_count * 1_000
53+
54+
cursor.execute("SELECT * FROM tpch.sf100.customer")
55+
while batch_count > 0:
56+
print(f"⏳ fetching batch {batch_count} of {batch_size} rows...")
57+
_ = cursor.fetchmany(batch_size)
58+
customer_count += batch_size
59+
batch_count = batch_count - 1
60+
61+
assert customer_count == expected_customers, (
62+
f"💀 crap! expected {expected_customers} customers, got {customer_count}"
6063
)
6164

6265
print("🎉 major success!")

tests/templates/kuttl/client-spooling/05-assert.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ commands:
77
- script: kubectl exec -n $NAMESPACE deployment/minio -- mc alias set local https://localhost:9000 minioAccessKey minioSecretKey --api S3v4
88
# Verify that the spooling bucket contains data
99
- script: |
10-
count=$(kubectl exec -n $NAMESPACE deployment/minio -- mc stat --insecure local/spooling-bucket | awk '/Objects count:/ {print $3}')
11-
if [ "$count" -gt 0 ]; then
12-
echo "Objects count is $count (> 0)"
13-
else
14-
echo "Objects count is $count (not > 0)"
10+
count=$(kubectl exec -n $NAMESPACE deployment/minio -- mc ls --insecure local/spooling-bucket/trino | wc -l)
11+
echo "Number of spool segments is [$count] (should be > 0)"
12+
if [ "$count" -eq 0 ]; then
1513
exit 1
1614
fi
1715
---

0 commit comments

Comments
 (0)