File tree Expand file tree Collapse file tree 3 files changed +4
-21
lines changed
examples/experimental/tests
src/databricks/sql/backend/sea Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ def test_sea_async_query_with_cloud_fetch():
4545 use_sea = True ,
4646 user_agent_entry = "SEA-Test-Client" ,
4747 use_cloud_fetch = True ,
48+ enable_query_result_lz4_compression = False ,
4849 )
4950
5051 logger .info (
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ def test_sea_sync_query_with_cloud_fetch():
4343 use_sea = True ,
4444 user_agent_entry = "SEA-Test-Client" ,
4545 use_cloud_fetch = True ,
46+ enable_query_result_lz4_compression = False ,
4647 )
4748
4849 logger .info (
Original file line number Diff line number Diff line change 55
66from databricks .sql .cloudfetch .download_manager import ResultFileDownloadManager
77
8- import lz4 . frame
8+ from databricks . sql . cloudfetch . downloader import ResultSetDownloadHandler
99
1010try :
1111 import pyarrow
3636logger = logging .getLogger (__name__ )
3737
3838
39- def decompress_multi_frame_lz4 (attachment : bytes ) -> bytes :
40- try :
41- decompressor = lz4 .frame .LZ4FrameDecompressor ()
42- arrow_file = decompressor .decompress (attachment )
43-
44- # the attachment may be a concatenation of multiple LZ4 frames
45- while decompressor .unused_data :
46- remaining_data = decompressor .unused_data
47- arrow_file += decompressor .decompress (remaining_data )
48-
49- logger .debug (f"LZ4 decompressed { len (arrow_file )} bytes from attachment" )
50-
51- except Exception as e :
52- logger .error (f"LZ4 decompression failed: { e } " )
53- raise e
54-
55- return arrow_file
56-
57-
5839class SeaResultSetQueueFactory (ABC ):
5940 @staticmethod
6041 def build_queue (
@@ -89,7 +70,7 @@ def build_queue(
8970 elif manifest .format == ResultFormat .ARROW_STREAM .value :
9071 if result_data .attachment is not None :
9172 arrow_file = (
92- decompress_multi_frame_lz4 (result_data .attachment )
73+ ResultSetDownloadHandler . _decompress_data (result_data .attachment )
9374 if lz4_compressed
9475 else result_data .attachment
9576 )
You can’t perform that action at this time.
0 commit comments