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+
515import argparse
616
717import 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
8599if __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"
0 commit comments