zhengruifeng commented on code in PR #49463: URL: https://github.com/apache/spark/pull/49463#discussion_r1912684938
########## python/pyspark/sql/functions/builtin.py: ########## @@ -16046,10 +16066,15 @@ def octet_length(col: "ColumnOrName") -> Column: Examples -------- - >>> from pyspark.sql.functions import octet_length + >>> from pyspark.sql import functions as sf >>> spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat']) \\ - ... .select(octet_length('cat')).collect() - [Row(octet_length(cat)=3), Row(octet_length(cat)=4)] + ... .select(sf.octet_length('cat')).show() Review Comment: let's also show the input columns ########## python/pyspark/sql/functions/builtin.py: ########## @@ -15177,9 +15177,9 @@ def rlike(str: "ColumnOrName", regexp: "ColumnOrName") -> Column: Parameters ---------- - str : :class:`~pyspark.sql.Column` or str + str : :class:`~pyspark.sql.Column` or column name target column to work on. - regexp : :class:`~pyspark.sql.Column` or str + regexp : :class:`~pyspark.sql.Column` or column name Review Comment: e.g. ``` df.select('*', sf.rlike("str", "regexp")).show() ``` ########## python/pyspark/sql/functions/builtin.py: ########## @@ -16076,10 +16101,15 @@ def bit_length(col: "ColumnOrName") -> Column: Examples -------- - >>> from pyspark.sql.functions import bit_length + >>> from pyspark.sql import functions as sf >>> spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat']) \\ - ... .select(bit_length('cat')).collect() - [Row(bit_length(cat)=24), Row(bit_length(cat)=32)] + ... .select(sf.bit_length('cat')).show() Review Comment: ditto ########## python/pyspark/sql/functions/builtin.py: ########## @@ -15177,9 +15177,9 @@ def rlike(str: "ColumnOrName", regexp: "ColumnOrName") -> Column: Parameters ---------- - str : :class:`~pyspark.sql.Column` or str + str : :class:`~pyspark.sql.Column` or column name target column to work on. - regexp : :class:`~pyspark.sql.Column` or str + regexp : :class:`~pyspark.sql.Column` or column name Review Comment: let's add an example of column name `regexp` ########## python/pyspark/sql/functions/builtin.py: ########## @@ -16076,10 +16101,15 @@ def bit_length(col: "ColumnOrName") -> Column: Examples -------- - >>> from pyspark.sql.functions import bit_length + >>> from pyspark.sql import functions as sf >>> spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat']) \\ Review Comment: ditto ########## python/pyspark/sql/functions/builtin.py: ########## @@ -16113,9 +16143,14 @@ def translate(srcCol: "ColumnOrName", matching: str, replace: str) -> Column: Examples -------- - >>> spark.createDataFrame([('translate',)], ['a']).select(translate('a', "rnlt", "123") \\ - ... .alias('r')).collect() - [Row(r='1a2s3ae')] + >>> from pyspark.sql import functions as sf + >>> spark.createDataFrame([('translate',)], ['a']) \\ Review Comment: ditto ########## python/pyspark/sql/functions/builtin.py: ########## @@ -16046,10 +16066,15 @@ def octet_length(col: "ColumnOrName") -> Column: Examples -------- - >>> from pyspark.sql.functions import octet_length + >>> from pyspark.sql import functions as sf >>> spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat']) \\ Review Comment: let's reformat the code to avoid usage of `\\` -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org