Skip to content

Commit b69bd07

Browse files
authored
CLN: Remove read_orc dtype checking (#51604)
1 parent f1acf8b commit b69bd07

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

pandas/io/orc.py

+2-21
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
)
2222
from pandas.compat._optional import import_optional_dependency
2323

24-
from pandas.core.dtypes.common import (
25-
is_categorical_dtype,
26-
is_interval_dtype,
27-
is_period_dtype,
28-
is_unsigned_integer_dtype,
29-
)
30-
3124
from pandas.core.arrays import ArrowExtensionArray
3225
from pandas.core.frame import DataFrame
3326

@@ -184,22 +177,10 @@ def to_orc(
184177
if engine_kwargs is None:
185178
engine_kwargs = {}
186179

187-
# If unsupported dtypes are found raise NotImplementedError
188-
# In Pyarrow 9.0.0 this check will no longer be needed
189-
for dtype in df.dtypes:
190-
if (
191-
is_categorical_dtype(dtype)
192-
or is_interval_dtype(dtype)
193-
or is_period_dtype(dtype)
194-
or is_unsigned_integer_dtype(dtype)
195-
):
196-
raise NotImplementedError(
197-
"The dtype of one or more columns is not supported yet."
198-
)
199-
200180
if engine != "pyarrow":
201181
raise ValueError("engine must be 'pyarrow'")
202182
engine = import_optional_dependency(engine, min_version="7.0.0")
183+
pa = import_optional_dependency("pyarrow")
203184
orc = import_optional_dependency("pyarrow.orc")
204185

205186
was_none = path is None
@@ -214,7 +195,7 @@ def to_orc(
214195
handles.handle,
215196
**engine_kwargs,
216197
)
217-
except TypeError as e:
198+
except (TypeError, pa.ArrowNotImplementedError) as e:
218199
raise NotImplementedError(
219200
"The dtype of one or more columns is not supported yet."
220201
) from e

0 commit comments

Comments
 (0)