Skip to content

Commit 2820441

Browse files
committed
simplify
1 parent 5b76edf commit 2820441

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

pandas/io/orc.py

+3-35
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import List, Optional
55

66
from pandas.compat._optional import import_optional_dependency
7-
from pandas.errors import AbstractMethodError
87

98
from pandas import DataFrame, get_option
109
from pandas._typing import FilePathOrBuffer
@@ -35,47 +34,16 @@ def get_engine(engine: str) -> "PyArrowImpl":
3534
if engine not in ["pyarrow"]:
3635
raise ValueError("engine must be 'pyarrow'")
3736

38-
if engine == "pyarrow":
39-
return PyArrowImpl()
37+
return PyArrowImpl()
4038

4139

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:
7341
def __init__(self):
7442
pyarrow = import_optional_dependency(
7543
"pyarrow", extra="pyarrow is required for orc support."
7644
)
7745

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
7947
import pyarrow
8048

8149
if distutils.version.LooseVersion(pyarrow.__version__) < "0.13.0":

0 commit comments

Comments
 (0)