24
24
from databricks .sql .thrift_api .TCLIService import ttypes
25
25
from databricks .sql .types import Row
26
26
from databricks .sql .exc import Error , RequestError , CursorAlreadyClosedError
27
- from databricks .sql .utils import ColumnTable , ColumnQueue , JsonQueue
27
+ from databricks .sql .utils import (
28
+ ColumnTable ,
29
+ ColumnQueue ,
30
+ JsonQueue ,
31
+ SeaResultSetQueueFactory ,
32
+ )
28
33
from databricks .sql .backend .types import CommandId , CommandState , ExecuteResponse
29
34
30
35
logger = logging .getLogger (__name__ )
@@ -475,6 +480,7 @@ def __init__(
475
480
result_data ,
476
481
manifest ,
477
482
str (execute_response .command_id .to_sea_statement_id ()),
483
+ ssl_options = connection .session .ssl_options ,
478
484
description = execute_response .description ,
479
485
max_download_threads = sea_client .max_download_threads ,
480
486
sea_client = sea_client ,
@@ -618,11 +624,11 @@ def fetchmany_arrow(self, size: int) -> "pyarrow.Table":
618
624
if size < 0 :
619
625
raise ValueError (f"size argument for fetchmany is { size } but must be >= 0" )
620
626
621
- if not isinstance (self .results , JsonQueue ):
622
- raise NotImplementedError ("fetchmany_arrow only supported for JSON data" )
627
+ results = self .results .next_n_rows (size )
628
+ if isinstance (self .results , JsonQueue ):
629
+ results = self ._convert_json_types (results )
630
+ results = self ._convert_json_to_arrow (results )
623
631
624
- rows = self ._convert_json_types (self .results .next_n_rows (size ))
625
- results = self ._convert_json_to_arrow (rows )
626
632
self ._next_row_index += results .num_rows
627
633
628
634
return results
@@ -632,11 +638,11 @@ def fetchall_arrow(self) -> "pyarrow.Table":
632
638
Fetch all remaining rows as an Arrow table.
633
639
"""
634
640
635
- if not isinstance (self .results , JsonQueue ):
636
- raise NotImplementedError ("fetchall_arrow only supported for JSON data" )
641
+ results = self .results .remaining_rows ()
642
+ if isinstance (self .results , JsonQueue ):
643
+ results = self ._convert_json_types (results )
644
+ results = self ._convert_json_to_arrow (results )
637
645
638
- rows = self ._convert_json_types (self .results .remaining_rows ())
639
- results = self ._convert_json_to_arrow (rows )
640
646
self ._next_row_index += results .num_rows
641
647
642
648
return results
0 commit comments