Skip to content

Commit 7e50ebd

Browse files
committed
update stress test
1 parent c2e4c79 commit 7e50ebd

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

test/stress/e2e_iterator.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
33
#
44

5+
"""
6+
This script is used for end-to-end performance test.
7+
It tracks the processing time from cursor fetching data till all data are converted to python objects.
8+
9+
There are two scenarios:
10+
11+
- row data conversion: fetch data and call `fetchall` on the cursor
12+
- table data conversion: fetch data and call `fetch_arrow_batches` on the cursor
13+
"""
14+
515
import argparse
616

717
import util as stress_util
@@ -65,14 +75,18 @@ def prepare_data(cursor, row_count=100, test_table_name="TEMP_ARROW_TEST_TABLE")
6575
)
6676

6777

68-
def task_fetch_rows(cursor, table_name):
69-
ret = cursor.execute(f"select * from {table_name}").fetchall()
78+
def task_fetch_rows(cursor, table_name, row_count_limit=50000):
79+
ret = cursor.execute(
80+
f"select * from {table_name} limit {row_count_limit}"
81+
).fetchall()
7082
for _ in ret:
7183
pass
7284

7385

74-
def task_fetch_arrow_batches(cursor, table_name):
75-
ret = cursor.execute(f"select * from {table_name}").fetch_arrow_batches()
86+
def task_fetch_arrow_batches(cursor, table_name, row_count_limit=50000):
87+
ret = cursor.execute(
88+
f"select * from {table_name} limit {row_count_limit}"
89+
).fetch_arrow_batches()
7690
for _ in ret:
7791
pass
7892

@@ -84,10 +98,24 @@ def execute_task(task, cursor, table_name, iteration_cnt):
8498

8599
if __name__ == "__main__":
86100
parser = argparse.ArgumentParser()
87-
parser.add_argument("--iteration_cnt", type=int, default=5000)
88-
parser.add_argument("--data_file", type=str, default="test_data")
89-
parser.add_argument("--row_count", type=int, default=100)
90-
parser.add_argument("--test_table_name", type=str, default="ARROW_TEST_TABLE")
101+
parser.add_argument(
102+
"--iteration_cnt",
103+
type=int,
104+
default=5000,
105+
help="how many times to run the test function, default is 5000",
106+
)
107+
parser.add_argument(
108+
"--row_count",
109+
type=int,
110+
default=100,
111+
help="how man rows of data to insert into the temp test able if test_table_name is not provided",
112+
)
113+
parser.add_argument(
114+
"--test_table_name",
115+
type=str,
116+
default="ARROW_TEST_TABLE",
117+
help="an existing test table that has data prepared, by default the it looks for 'ARROW_TEST_TABLE'",
118+
)
91119
args = parser.parse_args()
92120

93121
test_table_name = "TEMP_ARROW_TEST_TABLE"

test/stress/local_iterator.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
33
#
44

5+
"""
6+
This script is used for PyArrowIterator performance test.
7+
It tracks the processing time of PyArrowIterator converting data to python objects.
8+
9+
There are two scenarios:
10+
11+
- row data conversion: PyArrowIterator convert data into list of tuple of python primitive objects
12+
- table data conversion: PyArrowIterator converts data into pyarrow table
13+
"""
14+
515
import argparse
616
import base64
717
import io
@@ -64,8 +74,18 @@ def execute_task(task, bytes_data, create_iterator_method, iteration_cnt):
6474

6575
if __name__ == "__main__":
6676
parser = argparse.ArgumentParser()
67-
parser.add_argument("--iteration_cnt", type=int, default=100000)
68-
parser.add_argument("--data_file", type=str, default="test_data")
77+
parser.add_argument(
78+
"--iteration_cnt",
79+
type=int,
80+
default=100000,
81+
help="how many times to run the test function, default is 100000",
82+
)
83+
parser.add_argument(
84+
"--data_file",
85+
type=str,
86+
default="test_data",
87+
help="a local file to read data from, the file contains base64 encoded string returned from snowflake",
88+
)
6989
args = parser.parse_args()
7090

7191
with open(args.data_file) as f:

test/stress/test_data

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)