|
12 | 12 | from ...config import get_option |
13 | 13 | from ...mysql.constants import FIELD_TYPE as ft |
14 | 14 | from ..dtypes import DEFAULT_VALUES |
15 | | -from ..dtypes import NUMPY_TYPE_MAP |
16 | | -from ..dtypes import PANDAS_TYPE_MAP |
17 | | -from ..dtypes import POLARS_TYPE_MAP |
18 | | -from ..dtypes import PYARROW_TYPE_MAP |
| 15 | +from ..dtypes import get_numpy_type_map |
| 16 | +from ..dtypes import get_polars_type_map |
| 17 | +from ..dtypes import get_pyarrow_type_map |
19 | 18 |
|
20 | 19 | if TYPE_CHECKING: |
21 | 20 | try: |
@@ -212,7 +211,7 @@ def _load_pandas( |
212 | 211 | index = pd.Series(row_ids) |
213 | 212 | return pd.Series(row_ids, dtype=np.int64), [ |
214 | 213 | ( |
215 | | - pd.Series(data, index=index, name=name, dtype=PANDAS_TYPE_MAP[dtype]), |
| 214 | + pd.Series(data, index=index, name=name, dtype=get_numpy_type_map()[dtype]), |
216 | 215 | pd.Series(mask, index=index, dtype=np.bool_), |
217 | 216 | ) |
218 | 217 | for (data, mask), (name, dtype) in zip(cols, colspec) |
@@ -247,7 +246,7 @@ def _load_polars( |
247 | 246 | return pl.Series(None, row_ids, dtype=pl.Int64), \ |
248 | 247 | [ |
249 | 248 | ( |
250 | | - pl.Series(name=name, values=data, dtype=POLARS_TYPE_MAP[dtype]), |
| 249 | + pl.Series(name=name, values=data, dtype=get_polars_type_map()[dtype]), |
251 | 250 | pl.Series(values=mask, dtype=pl.Boolean), |
252 | 251 | ) |
253 | 252 | for (data, mask), (name, dtype) in zip(cols, colspec) |
@@ -282,7 +281,7 @@ def _load_numpy( |
282 | 281 | return np.asarray(row_ids, dtype=np.int64), \ |
283 | 282 | [ |
284 | 283 | ( |
285 | | - np.asarray(data, dtype=NUMPY_TYPE_MAP[dtype]), # type: ignore |
| 284 | + np.asarray(data, dtype=get_numpy_type_map()[dtype]), # type: ignore |
286 | 285 | np.asarray(mask, dtype=np.bool_), # type: ignore |
287 | 286 | ) |
288 | 287 | for (data, mask), (name, dtype) in zip(cols, colspec) |
@@ -318,7 +317,7 @@ def _load_arrow( |
318 | 317 | [ |
319 | 318 | ( |
320 | 319 | pa.array( |
321 | | - data, type=PYARROW_TYPE_MAP[dtype], |
| 320 | + data, type=get_pyarrow_type_map()[dtype], |
322 | 321 | mask=pa.array(mask, type=pa.bool_()), |
323 | 322 | ), |
324 | 323 | pa.array(mask, type=pa.bool_()), |
@@ -565,7 +564,7 @@ def _load_pandas_accel( |
565 | 564 | numpy_ids, numpy_cols = _singlestoredb_accel.load_rowdat_1_numpy(colspec, data) |
566 | 565 | cols = [ |
567 | 566 | ( |
568 | | - pd.Series(data, name=name, dtype=PANDAS_TYPE_MAP[dtype]), |
| 567 | + pd.Series(data, name=name, dtype=get_numpy_type_map()[dtype]), |
569 | 568 | pd.Series(mask, dtype=np.bool_), |
570 | 569 | ) |
571 | 570 | for (name, dtype), (data, mask) in zip(colspec, numpy_cols) |
@@ -610,7 +609,7 @@ def _load_polars_accel( |
610 | 609 | pl.Series( |
611 | 610 | name=name, values=data.tolist() |
612 | 611 | if dtype in string_types or dtype in binary_types else data, |
613 | | - dtype=POLARS_TYPE_MAP[dtype], |
| 612 | + dtype=get_polars_type_map()[dtype], |
614 | 613 | ), |
615 | 614 | pl.Series(values=mask, dtype=pl.Boolean), |
616 | 615 | ) |
@@ -653,7 +652,7 @@ def _load_arrow_accel( |
653 | 652 | numpy_ids, numpy_cols = _singlestoredb_accel.load_rowdat_1_numpy(colspec, data) |
654 | 653 | cols = [ |
655 | 654 | ( |
656 | | - pa.array(data, type=PYARROW_TYPE_MAP[dtype], mask=mask), |
| 655 | + pa.array(data, type=get_pyarrow_type_map()[dtype], mask=mask), |
657 | 656 | pa.array(mask, type=pa.bool_()), |
658 | 657 | ) |
659 | 658 | for (data, mask), (name, dtype) in zip(numpy_cols, colspec) |
|
0 commit comments