Skip to content

Commit 239cd8d

Browse files
remove custom multi-frame decompressor for lz4
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 7f67cfc commit 239cd8d

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

examples/experimental/tests/test_sea_async_query.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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(

examples/experimental/tests/test_sea_sync_query.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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(

src/databricks/sql/backend/sea/queue.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from databricks.sql.cloudfetch.download_manager import ResultFileDownloadManager
77

8-
import lz4.frame
8+
from databricks.sql.cloudfetch.downloader import ResultSetDownloadHandler
99

1010
try:
1111
import pyarrow
@@ -36,25 +36,6 @@
3636
logger = 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-
5839
class 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
)

0 commit comments

Comments
 (0)