Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/20217#discussion_r161126125 --- Diff: python/pyspark/sql/context.py --- @@ -203,18 +203,48 @@ def registerFunction(self, name, f, returnType=StringType()): >>> _ = sqlContext.udf.register("stringLengthInt", lambda x: len(x), IntegerType()) >>> sqlContext.sql("SELECT stringLengthInt('test')").collect() [Row(stringLengthInt(test)=4)] + """ + return self.sparkSession.catalog.registerFunction(name, f, returnType) + + @ignore_unicode_prefix + @since(2.3) + def registerUDF(self, name, f): + """Registers a :class:`UserDefinedFunction`. The registered UDF can be used in SQL + statements. + + :param name: name of the UDF in SQL statements + :param f: a wrapped/native UserDefinedFunction. The UDF can be either row-at-a-time or + scalar vectorized. For example, the object returned by udf or pandas_udf. + Grouped vectorized UDFs are not supported. + :return: a wrapped :class:`UserDefinedFunction` --- End diff -- nit: I think this can be `a wrapped/native UserDefinedFunction.`.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org