zhengruifeng commented on PR #39462: URL: https://github.com/apache/spark/pull/39462#issuecomment-1375295176
the duplicated names will be supported after https://github.com/apache/spark/pull/39461 get merged. but for duplicated field names in nested struct like. `df.select(F.struct("a", "a"))` it works in PySpark ``` [Row(struct(a, a)=Row(a=1, a=1)), Row(struct(a, a)=Row(a=2, a=2)), Row(struct(a, a)=Row(a=3, a=3))] ``` but fails in `RecordBatchReader.read_next_batch`: ``` ERROR [0.583s]: test_collect_nested_type (pyspark.sql.tests.connect.test_connect_basic.SparkConnectBasicTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/ruifeng.zheng/Dev/spark/python/pyspark/sql/tests/connect/test_connect_basic.py", line 2038, in test_collect_nested_type cdf.select(CF.struct("a", "a")).collect(), File "/Users/ruifeng.zheng/Dev/spark/python/pyspark/sql/connect/dataframe.py", line 1148, in collect table = self._session.client.to_table(query) File "/Users/ruifeng.zheng/Dev/spark/python/pyspark/sql/connect/client.py", line 415, in to_table table, _ = self._execute_and_fetch(req) File "/Users/ruifeng.zheng/Dev/spark/python/pyspark/sql/connect/client.py", line 589, in _execute_and_fetch for batch in reader: File "pyarrow/ipc.pxi", line 638, in __iter__ File "pyarrow/ipc.pxi", line 674, in pyarrow.lib.RecordBatchReader.read_next_batch File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Ran out of field metadata, likely malformed ``` seems duplicated fields names are not allowed in `RecordBatchReader`. The only approach I can image is to: 1, in the server side: check the deduplicated names and modify the schema if necessary; 2, in the client side: convert the schema back after fetch the arrow data. -- 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]
