You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ueshin (via GitHub)" <gi...@apache.org> on 2023/07/26 21:51:50 UTC

[GitHub] [spark] ueshin opened a new pull request, #42176: [SPARK-44479][PYTHON][3.5] Fix ArrowStreamPandasUDFSerializer to accept no-column pandas DataFrame

ueshin opened a new pull request, #42176:
URL: https://github.com/apache/spark/pull/42176

   ### What changes were proposed in this pull request?
   
   Fixes `ArrowStreamPandasUDFSerializer` to accept no-column pandas DataFrame.
   
   ```py
   >>> def _scalar_f(id):
   ...   return pd.DataFrame(index=id)
   ...
   >>> scalar_f = pandas_udf(_scalar_f, returnType=StructType())
   >>> df = spark.range(3).withColumn("f", scalar_f(col("id")))
   >>> df.printSchema()
   root
    |-- id: long (nullable = false)
    |-- f: struct (nullable = true)
   
   >>> df.show()
   +---+---+
   | id|  f|
   +---+---+
   |  0| {}|
   |  1| {}|
   |  2| {}|
   +---+---+
   ```
   
   ### Why are the changes needed?
   
   The above query fails with the following error:
   
   ```py
   >>> df.show()
   org.apache.spark.api.python.PythonException: Traceback (most recent call last):
   ...
   ValueError: not enough values to unpack (expected 2, got 0)
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, Pandas UDF will accept no-column pandas DataFrame.
   
   ### How was this patch tested?
   
   Added related tests.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ueshin commented on pull request #42176: [SPARK-44479][PYTHON][3.5] Fix ArrowStreamPandasUDFSerializer to accept no-column pandas DataFrame

Posted by "ueshin (via GitHub)" <gi...@apache.org>.
ueshin commented on PR #42176:
URL: https://github.com/apache/spark/pull/42176#issuecomment-1652752178

   Thanks! merging to 3.5.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ueshin closed pull request #42176: [SPARK-44479][PYTHON][3.5] Fix ArrowStreamPandasUDFSerializer to accept no-column pandas DataFrame

Posted by "ueshin (via GitHub)" <gi...@apache.org>.
ueshin closed pull request #42176: [SPARK-44479][PYTHON][3.5] Fix ArrowStreamPandasUDFSerializer to accept no-column pandas DataFrame
URL: https://github.com/apache/spark/pull/42176


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org