@@ -49,11 +49,13 @@ def test_query_with_large_wide_result_set(self):
4949 # This is used by PyHive tests to determine the buffer size
5050 self .arraysize = 1000
5151 with self .cursor () as cursor :
52- uuids = ", " .join (["uuid() uuid{}" .format (i ) for i in range (cols )])
53- cursor .execute ("SELECT id, {uuids} FROM RANGE({rows})" .format (uuids = uuids , rows = rows ))
54- for row_id , row in enumerate (self .fetch_rows (cursor , rows , fetchmany_size )):
55- self .assertEqual (row [0 ], row_id ) # Verify no rows are dropped in the middle.
56- self .assertEqual (len (row [1 ]), 36 )
52+ for lz4_compression in [False , True ]:
53+ cursor .setLZ4Compression (lz4_compression )
54+ uuids = ", " .join (["uuid() uuid{}" .format (i ) for i in range (cols )])
55+ cursor .execute ("SELECT id, {uuids} FROM RANGE({rows})" .format (uuids = uuids , rows = rows ))
56+ for row_id , row in enumerate (self .fetch_rows (cursor , rows , fetchmany_size )):
57+ self .assertEqual (row [0 ], row_id ) # Verify no rows are dropped in the middle.
58+ self .assertEqual (len (row [1 ]), 36 )
5759
5860 def test_query_with_large_narrow_result_set (self ):
5961 resultSize = 300 * 1000 * 1000 # 300 MB
@@ -65,9 +67,11 @@ def test_query_with_large_narrow_result_set(self):
6567 # This is used by PyHive tests to determine the buffer size
6668 self .arraysize = 10000000
6769 with self .cursor () as cursor :
68- cursor .execute ("SELECT * FROM RANGE({rows})" .format (rows = rows ))
69- for row_id , row in enumerate (self .fetch_rows (cursor , rows , fetchmany_size )):
70- self .assertEqual (row [0 ], row_id )
70+ for lz4_compression in [False , True ]:
71+ cursor .setLZ4Compression (lz4_compression )
72+ cursor .execute ("SELECT * FROM RANGE({rows})" .format (rows = rows ))
73+ for row_id , row in enumerate (self .fetch_rows (cursor , rows , fetchmany_size )):
74+ self .assertEqual (row [0 ], row_id )
7175
7276 def test_long_running_query (self ):
7377 """ Incrementally increase query size until it takes at least 5 minutes,
@@ -80,21 +84,23 @@ def test_long_running_query(self):
8084 scale0 = 10000
8185 scale_factor = 1
8286 with self .cursor () as cursor :
83- while duration < min_duration :
84- self .assertLess (scale_factor , 512 , msg = "Detected infinite loop" )
85- start = time .time ()
87+ for lz4_compression in [False , True ]:
88+ cursor .setLZ4Compression (lz4_compression )
89+ while duration < min_duration :
90+ self .assertLess (scale_factor , 512 , msg = "Detected infinite loop" )
91+ start = time .time ()
8692
87- cursor .execute ("""SELECT count(*)
88- FROM RANGE({scale}) x
89- JOIN RANGE({scale0}) y
90- ON from_unixtime(x.id * y.id, "yyyy-MM-dd") LIKE "%not%a%date%"
91- """ .format (scale = scale_factor * scale0 , scale0 = scale0 ))
93+ cursor .execute ("""SELECT count(*)
94+ FROM RANGE({scale}) x
95+ JOIN RANGE({scale0}) y
96+ ON from_unixtime(x.id * y.id, "yyyy-MM-dd") LIKE "%not%a%date%"
97+ """ .format (scale = scale_factor * scale0 , scale0 = scale0 ))
9298
93- n , = cursor .fetchone ()
94- self .assertEqual (n , 0 )
99+ n , = cursor .fetchone ()
100+ self .assertEqual (n , 0 )
95101
96- duration = time .time () - start
97- current_fraction = duration / min_duration
98- print ('Took {} s with scale factor={}' .format (duration , scale_factor ))
99- # Extrapolate linearly to reach 5 min and add 50% padding to push over the limit
100- scale_factor = math .ceil (1.5 * scale_factor / current_fraction )
102+ duration = time .time () - start
103+ current_fraction = duration / min_duration
104+ print ('Took {} s with scale factor={}' .format (duration , scale_factor ))
105+ # Extrapolate linearly to reach 5 min and add 50% padding to push over the limit
106+ scale_factor = math .ceil (1.5 * scale_factor / current_fraction )
0 commit comments