Github user icexelloss commented on a diff in the pull request: https://github.com/apache/spark/pull/20217#discussion_r160861434 --- Diff: python/pyspark/sql/context.py --- @@ -203,18 +203,46 @@ 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): --- End diff -- I prefer not to duplicate the doc string. Maybe we can put the docstring in the user facing API (I think it's the SQLContext one?) And reference the doc string in the other one. Or, maybe we can do sth like this if we want both docstrings ``` @ignore_unicode_prefix @since(2.3) def registerUDF(self, name, f): return self.sparkSession.catalog.registerUDF(name, f) registerUDF.__doc__ = pyspark.sql.catalog.Catalog.registerUDF.__doc__ ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org