66# cython: language_level=3
77
88from base64 import b64decode
9+ from libcpp cimport bool
910import io
1011from logging import getLogger
1112from .telemetry import TelemetryField
@@ -35,11 +36,14 @@ cdef class ArrowResult:
3536 object _chunk_downloader
3637 object _arrow_context
3738 str _iter_unit
39+ object _use_dict_result
3840
39- def __init__ (self , raw_response , cursor , _chunk_downloader = None ):
41+
42+ def __init__ (self , raw_response , cursor , use_dict_result = False , _chunk_downloader = None ):
4043 self ._reset()
4144 self ._cursor = cursor
4245 self ._connection = cursor.connection
46+ self ._use_dict_result = use_dict_result
4347 self ._chunk_info(raw_response, _chunk_downloader)
4448
4549 def _chunk_info (self , data , _chunk_downloader = None ):
@@ -53,10 +57,10 @@ cdef class ArrowResult:
5357 if rowset_b64:
5458 arrow_bytes = b64decode(rowset_b64)
5559 self ._arrow_context = ArrowConverterContext(self ._connection._session_parameters)
56- self ._current_chunk_row = PyArrowIterator(io.BytesIO(arrow_bytes), self ._arrow_context)
60+ self ._current_chunk_row = PyArrowIterator(io.BytesIO(arrow_bytes), self ._arrow_context, self ._use_dict_result )
5761 else :
5862 logger.debug(" Data from first gs response is empty" )
59- self ._current_chunk_row = EmptyPyArrowIterator(None , None )
63+ self ._current_chunk_row = EmptyPyArrowIterator()
6064 self ._iter_unit = EMPTY_UNIT
6165
6266 if u ' chunks' in data:
@@ -127,7 +131,7 @@ cdef class ArrowResult:
127131 self ._chunk_downloader._total_millis_parsing_chunks)
128132 self ._chunk_downloader = None
129133 self ._chunk_count = 0
130- self ._current_chunk_row = EmptyPyArrowIterator(None , None )
134+ self ._current_chunk_row = EmptyPyArrowIterator()
131135 is_done = True
132136
133137 if is_done:
@@ -149,7 +153,7 @@ cdef class ArrowResult:
149153 def _reset (self ):
150154 self .total_row_index = - 1 # last fetched number of rows
151155 self ._current_chunk_row_count = 0
152- self ._current_chunk_row = EmptyPyArrowIterator(None , None )
156+ self ._current_chunk_row = EmptyPyArrowIterator()
153157 self ._chunk_index = 0
154158
155159 if hasattr (self , u ' _chunk_count' ) and self ._chunk_count > 0 and \
@@ -208,7 +212,7 @@ cdef class ArrowResult:
208212 self ._chunk_downloader._total_millis_parsing_chunks)
209213 self ._chunk_downloader = None
210214 self ._chunk_count = 0
211- self ._current_chunk_row = EmptyPyArrowIterator(None , None )
215+ self ._current_chunk_row = EmptyPyArrowIterator()
212216 finally :
213217 if self ._cursor._first_chunk_time:
214218 logger.info(" fetching data into pandas dataframe done" )
0 commit comments