allisonwang-db commented on code in PR #44531:
URL: https://github.com/apache/spark/pull/44531#discussion_r1439188636
##########
python/pyspark/sql/worker/plan_data_source_read.py:
##########
@@ -258,8 +261,25 @@ def batched(iterator: Iterator, n: int) -> Iterator:
},
)
- for col in range(num_cols):
- pylist[col].append(column_converters[col](result[col]))
+ # Assign output values by name of the field, not position,
if the result is a
+ # named `Row` object.
+ if isinstance(result, Row) and hasattr(result,
"__fields__"):
Review Comment:
This is actually different from `assign_cols_by_name` which re-arranges
arrow batch columns by the arrow type names. Here we want to match a single
named `Row` object to the return schema. The only way to tell whether it's
named `Row(a=1, b=1)` from an unnamed `Row(1,2)` is by checking this
`__fields__`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]