@@ -99,7 +99,6 @@ def collect_benchmark_result(
9999 <= len (bytes_files )
100100 == len (query_char_count_files )
101101 == len (local_seconds_files )
102- == len (total_rows_files )
103102 ):
104103 raise ValueError (
105104 "Mismatch in the number of report files for bytes, millis, seconds and query char count: \n "
@@ -108,10 +107,10 @@ def collect_benchmark_result(
108107 f"bytes_files: { len (bytes_files )} \n "
109108 f"query_char_count_files: { len (query_char_count_files )} \n "
110109 f"local_seconds_files: { len (local_seconds_files )} \n "
111- f"total_rows_files: { len (total_rows_files )} \n "
112110 )
113111
114112 has_full_metrics = len (bq_seconds_files ) == len (local_seconds_files )
113+ has_total_rows = len (total_rows_files ) == len (local_seconds_files )
115114
116115 for idx in range (len (local_seconds_files )):
117116 query_char_count_file = query_char_count_files [idx ]
@@ -141,18 +140,14 @@ def collect_benchmark_result(
141140 if not has_full_metrics :
142141 total_slot_millis = None
143142 bq_seconds = None
144- total_rows = None
145143 else :
146144 millis_file = millis_files [idx ]
147145 bq_seconds_file = bq_seconds_files [idx ]
148- total_rows_file = total_rows_files [idx ]
149- if (
150- filename != millis_file .relative_to (path ).with_suffix ("" )
151- or filename != bq_seconds_file .relative_to (path ).with_suffix ("" )
152- or filename != total_rows_file .relative_to (path ).with_suffix ("" )
153- ):
146+ if filename != millis_file .relative_to (path ).with_suffix (
147+ ""
148+ ) or filename != bq_seconds_file .relative_to (path ).with_suffix ("" ):
154149 raise ValueError (
155- "File name mismatch among query_char_count, bytes, millis, seconds and total_rows reports."
150+ "File name mismatch among query_char_count, bytes, millis, and seconds reports."
156151 )
157152
158153 with open (millis_file , "r" ) as file :
@@ -163,6 +158,15 @@ def collect_benchmark_result(
163158 lines = file .read ().splitlines ()
164159 bq_seconds = sum (float (line ) for line in lines ) / iterations
165160
161+ if not has_total_rows :
162+ total_rows = None
163+ else :
164+ total_rows_file = total_rows_files [idx ]
165+ if filename != total_rows_file .relative_to (path ).with_suffix ("" ):
166+ raise ValueError (
167+ "File name mismatch among query_char_count, bytes, and total_rows reports."
168+ )
169+
166170 with open (total_rows_file , "r" ) as file :
167171 lines = file .read ().splitlines ()
168172 total_rows = sum (int (line ) for line in lines ) / iterations
@@ -220,7 +224,11 @@ def collect_benchmark_result(
220224 print (
221225 f"{ index } - query count: { row ['Query_Count' ]} ,"
222226 + f" query char count: { row ['Query_Char_Count' ]} ,"
223- + f" total rows: { row ['Total_Rows' ]} ,"
227+ + (
228+ f" total rows: { row ['Total_Rows' ]} ,"
229+ if not pd .isna (row ["Total_Rows" ])
230+ else ""
231+ )
224232 + f" bytes processed sum: { row ['Bytes_Processed' ]} ,"
225233 + (f" slot millis sum: { row ['Slot_Millis' ]} ," if has_full_metrics else "" )
226234 + f" local execution time: { formatted_local_exec_time } seconds"
0 commit comments