99import requests
1010import json
1111import os
12- import decimal
1312from uuid import UUID
1413
1514from databricks .sql import __version__
3130 transform_paramstyle ,
3231 ColumnTable ,
3332 ColumnQueue ,
34- concat_chunked_tables ,
35- merge_columnar ,
3633)
3734from databricks .sql .parameters .native import (
3835 DbsqlParameterBase ,
@@ -1402,7 +1399,7 @@ def _convert_columnar_table(self, table: ColumnTable):
14021399 result .append (ResultRow (* curr_row ))
14031400
14041401 return result
1405-
1402+
14061403 def _convert_arrow_table (self , table : "pyarrow.Table" ):
14071404
14081405 column_names = [c [0 ] for c in self .description ]
@@ -1411,7 +1408,7 @@ def _convert_arrow_table(self, table: "pyarrow.Table"):
14111408 if self .connection .disable_pandas is True :
14121409 columns_as_lists = [col .to_pylist () for col in table .itercolumns ()]
14131410 return [ResultRow (* row ) for row in zip (* columns_as_lists )]
1414-
1411+
14151412 # Need to use nullable types, as otherwise type can change when there are missing values.
14161413 # See https://arrow.apache.org/docs/python/pandas.html#nullable-types
14171414 # NOTE: This api is epxerimental https://pandas.pydata.org/pandas-docs/stable/user_guide/integer_na.html
@@ -1445,7 +1442,7 @@ def _convert_arrow_table(self, table: "pyarrow.Table"):
14451442 @property
14461443 def rownumber (self ):
14471444 return self ._next_row_index
1448-
1445+
14491446 def fetchmany_arrow (self , size : int ) -> "pyarrow.Table" :
14501447 """
14511448 Fetch the next set of rows of a query result, returning a PyArrow table.
@@ -1494,18 +1491,18 @@ def fetchmany_columnar(self, size: int):
14941491 self ._next_row_index += partial_results .num_rows
14951492
14961493 return results
1497-
1494+
14981495 def fetchall_arrow (self ) -> "pyarrow.Table" :
14991496 """Fetch all (remaining) rows of a query result, returning them as a PyArrow table."""
15001497 results = self .results .remaining_rows ()
15011498 self ._next_row_index += results .num_rows
1502-
1499+
15031500 while not self .has_been_closed_server_side and self .has_more_rows :
15041501 self ._fill_results_buffer ()
15051502 partial_results = self .results .remaining_rows ()
15061503 results .append (partial_results )
15071504 self ._next_row_index += partial_results .num_rows
1508-
1505+
15091506 return results .to_arrow_table ()
15101507
15111508 def fetchall_columnar (self ):
@@ -1516,7 +1513,7 @@ def fetchall_columnar(self):
15161513 while not self .has_been_closed_server_side and self .has_more_rows :
15171514 self ._fill_results_buffer ()
15181515 partial_results = self .results .remaining_rows ()
1519- results = merge_columnar ( results , partial_results )
1516+ results . append ( partial_results )
15201517 self ._next_row_index += partial_results .num_rows
15211518
15221519 return results
0 commit comments