PerilousApricot commented on pull request #34505:
URL: https://github.com/apache/spark/pull/34505#issuecomment-964650255
Hi @HyukjinKwon - thanks for this PR! I had a question about the
python-facing API. Is it possible to have something similar to how current
python/pandas UDFs' withColumn() can tell spark which columns are necessary for
the inputs and pass the remainder of the columns through to the resulting DF
without round-tripping them through python? For example (open-coding this,
might be missing some syntax):
```python
df = spark.createDataFrame(
[(1, "foo"), (2, None), (3, "bar"), (4, "bar")], "a int, b string")
@udf(IntType())
def squared(x):
return x * x
df = df.withColumn("squared", squared["a"]))
```
Would only ser/de the "a" column through the function, but the remaining
column "b" would be in the resulting dataframe.
--
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]