File tree 1 file changed +11
-16
lines changed
1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -327,23 +327,18 @@ def to_pyarrow(
327
327
"""
328
328
pa = self ._import_pyarrow ()
329
329
self ._run_pre_execute_hooks (expr )
330
+
330
331
table_expr = expr .as_table ()
331
- arrow_schema = table_expr .schema ().to_pyarrow ()
332
- try :
333
- with self .to_pyarrow_batches (
334
- table_expr , params = params , limit = limit , ** kwargs
335
- ) as reader :
336
- table = (
337
- pa .Table .from_batches (reader )
338
- .rename_columns (table_expr .columns )
339
- .cast (arrow_schema )
340
- )
341
- except pa .lib .ArrowInvalid :
342
- raise
343
- except ValueError :
344
- table = arrow_schema .empty_table ()
345
-
346
- return expr .__pyarrow_result__ (table )
332
+ schema = table_expr .schema ()
333
+ arrow_schema = schema .to_pyarrow ()
334
+ with self .to_pyarrow_batches (
335
+ table_expr , params = params , limit = limit , ** kwargs
336
+ ) as reader :
337
+ table = pa .Table .from_batches (reader , schema = arrow_schema )
338
+
339
+ return expr .__pyarrow_result__ (
340
+ table .rename_columns (table_expr .columns ).cast (arrow_schema )
341
+ )
347
342
348
343
@util .experimental
349
344
def to_pyarrow_batches (
You can’t perform that action at this time.
0 commit comments