File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3- from typing import TYPE_CHECKING
3+ from typing import (
4+ TYPE_CHECKING ,
5+ Literal ,
6+ )
47
58import numpy as np
69
1518if TYPE_CHECKING :
1619 from collections .abc import Callable
1720
21+ import pyarrow
22+
1823 from pandas ._typing import DtypeBackend
1924
2025
@@ -52,8 +57,8 @@ def _arrow_string_types_mapper() -> Callable:
5257
5358
5459def arrow_table_to_pandas (
55- table ,
56- dtype_backend : DtypeBackend | lib .NoDefault = lib .no_default ,
60+ table : pyarrow . Table ,
61+ dtype_backend : DtypeBackend | Literal [ "numpy" ] | lib .NoDefault = lib .no_default ,
5762 null_to_int64 : bool = False ,
5863) -> pd .DataFrame :
5964 pa = import_optional_dependency ("pyarrow" )
@@ -70,7 +75,7 @@ def arrow_table_to_pandas(
7075 types_mapper = pd .ArrowDtype
7176 elif using_string_dtype ():
7277 types_mapper = _arrow_string_types_mapper ()
73- elif dtype_backend is lib .no_default :
78+ elif dtype_backend is lib .no_default or dtype_backend == "numpy" :
7479 types_mapper = None
7580 else :
7681 raise NotImplementedError
Original file line number Diff line number Diff line change @@ -2210,9 +2210,6 @@ def read_table(
22102210 with self .con .cursor () as cur :
22112211 cur .execute (stmt )
22122212 pa_table = cur .fetch_arrow_table ()
2213- dtype_backend = (
2214- lib .no_default if dtype_backend == "numpy" else dtype_backend
2215- )
22162213 df = arrow_table_to_pandas (pa_table , dtype_backend = dtype_backend )
22172214
22182215 return _wrap_result_adbc (
@@ -2284,9 +2281,6 @@ def read_query(
22842281 with self .con .cursor () as cur :
22852282 cur .execute (sql )
22862283 pa_table = cur .fetch_arrow_table ()
2287- dtype_backend = (
2288- lib .no_default if dtype_backend == "numpy" else dtype_backend
2289- )
22902284 df = arrow_table_to_pandas (pa_table , dtype_backend = dtype_backend )
22912285
22922286 return _wrap_result_adbc (
You can’t perform that action at this time.
0 commit comments