Skip to content

Commit 004c3dc

Browse files
assign manifest.is_volume_operation to is_staging_operation
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent a74d279 commit 004c3dc

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def _results_message_to_execute_response(
350350
description=description,
351351
has_been_closed_server_side=False,
352352
lz4_compressed=lz4_compressed,
353-
is_staging_operation=False,
353+
is_staging_operation=response.manifest.is_volume_operation,
354354
arrow_schema_bytes=None,
355355
result_format=response.manifest.format,
356356
)

src/databricks/sql/backend/sea/models/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ class ResultManifest:
9292
truncated: bool = False
9393
chunks: Optional[List[ChunkInfo]] = None
9494
result_compression: Optional[str] = None
95-
is_volume_operation: Optional[bool] = None
95+
is_volume_operation: bool = False

src/databricks/sql/backend/sea/models/responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _parse_manifest(data: Dict[str, Any]) -> ResultManifest:
6565
truncated=manifest_data.get("truncated", False),
6666
chunks=chunks,
6767
result_compression=manifest_data.get("result_compression"),
68-
is_volume_operation=manifest_data.get("is_volume_operation"),
68+
is_volume_operation=manifest_data.get("is_volume_operation", False),
6969
)
7070

7171

tests/unit/test_sea_backend.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,31 @@ def test_utility_methods(self, sea_client):
632632
sea_client._extract_description_from_manifest(no_columns_manifest) is None
633633
)
634634

635+
def test_results_message_to_execute_response_is_staging_operation(self, sea_client):
636+
"""Test that is_staging_operation is correctly set from manifest.is_volume_operation."""
637+
# Test when is_volume_operation is True
638+
response = MagicMock()
639+
response.statement_id = "test-statement-123"
640+
response.status.state = CommandState.SUCCEEDED
641+
response.manifest.is_volume_operation = True
642+
response.manifest.result_compression = "NONE"
643+
response.manifest.format = "JSON_ARRAY"
644+
645+
# Mock the _extract_description_from_manifest method to return None
646+
with patch.object(
647+
sea_client, "_extract_description_from_manifest", return_value=None
648+
):
649+
result = sea_client._results_message_to_execute_response(response)
650+
assert result.is_staging_operation is True
651+
652+
# Test when is_volume_operation is False
653+
response.manifest.is_volume_operation = False
654+
with patch.object(
655+
sea_client, "_extract_description_from_manifest", return_value=None
656+
):
657+
result = sea_client._results_message_to_execute_response(response)
658+
assert result.is_staging_operation is False
659+
635660
def test_unimplemented_metadata_methods(
636661
self, sea_client, sea_session_id, mock_cursor
637662
):

0 commit comments

Comments
 (0)