zero323 commented on a change in pull request #27406:
[SPARK-30681][PYSPARK][SQL] Add higher order functions API to PySpark
URL: https://github.com/apache/spark/pull/27406#discussion_r373305013
##########
File path: python/pyspark/sql/functions.py
##########
@@ -2840,6 +2840,360 @@ def from_csv(col, schema, options={}):
return Column(jc)
+def _invoke_higher_order_function(name):
+ """
+ Given name of the expression corresponding to a higher order SQL function,
+ return a function that takes
+
+ - a list of columns
+ - a list of tuples ((*Column) -> Column, Iterable[int])
+ where the second element represent allowed arities
+
+ invokes expression, and wraps result in a Column
+ (first Scala one, then Python).
+ """
+
+ def _(cols, funs):
Review comment:
@HyukjinKwon
> I know you were trying to logically separate the actual function but how
about we just avoid having a nested function here?
Not a problem. It felt natural to think about the data flow this way, but I
am not very attached to this approach.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]