|
4 | 4 | from typing import List, Optional
|
5 | 5 |
|
6 | 6 | from pandas.compat._optional import import_optional_dependency
|
7 |
| -from pandas.errors import AbstractMethodError |
8 | 7 |
|
9 | 8 | from pandas import DataFrame, get_option
|
10 | 9 | from pandas._typing import FilePathOrBuffer
|
@@ -35,47 +34,16 @@ def get_engine(engine: str) -> "PyArrowImpl":
|
35 | 34 | if engine not in ["pyarrow"]:
|
36 | 35 | raise ValueError("engine must be 'pyarrow'")
|
37 | 36 |
|
38 |
| - if engine == "pyarrow": |
39 |
| - return PyArrowImpl() |
| 37 | + return PyArrowImpl() |
40 | 38 |
|
41 | 39 |
|
42 |
| -class BaseImpl: |
43 |
| - |
44 |
| - api = None # module |
45 |
| - |
46 |
| - @staticmethod |
47 |
| - def validate_dataframe(df: DataFrame): |
48 |
| - |
49 |
| - if not isinstance(df, DataFrame): |
50 |
| - raise ValueError("to_orc only supports IO with DataFrames") |
51 |
| - |
52 |
| - # must have value column names (strings only) |
53 |
| - if df.columns.inferred_type not in {"string", "unicode", "empty"}: |
54 |
| - raise ValueError("ORC must have string column names") |
55 |
| - |
56 |
| - # index level names must be strings |
57 |
| - valid_names = all( |
58 |
| - isinstance(name, str) for name in df.index.names if name is not None |
59 |
| - ) |
60 |
| - if not valid_names: |
61 |
| - raise ValueError("Index level names must be strings") |
62 |
| - |
63 |
| - def write(self, df: DataFrame, path: FilePathOrBuffer, compression: str, **kwargs): |
64 |
| - raise AbstractMethodError(self) |
65 |
| - |
66 |
| - def read( |
67 |
| - self, path: FilePathOrBuffer, columns: Optional[List[str]] = None, **kwargs |
68 |
| - ): |
69 |
| - raise AbstractMethodError(self) |
70 |
| - |
71 |
| - |
72 |
| -class PyArrowImpl(BaseImpl): |
| 40 | +class PyArrowImpl: |
73 | 41 | def __init__(self):
|
74 | 42 | pyarrow = import_optional_dependency(
|
75 | 43 | "pyarrow", extra="pyarrow is required for orc support."
|
76 | 44 | )
|
77 | 45 |
|
78 |
| - # we require a newer version of pyarrow that we support for parquet |
| 46 | + # we require a newer version of pyarrow thaN we support for parquet |
79 | 47 | import pyarrow
|
80 | 48 |
|
81 | 49 | if distutils.version.LooseVersion(pyarrow.__version__) < "0.13.0":
|
|
0 commit comments