Github user map222 commented on a diff in the pull request: https://github.com/apache/spark/pull/17865#discussion_r121860425 --- Diff: python/pyspark/sql/functions.py --- @@ -1254,23 +1294,41 @@ def hash(*cols): # ---------------------- String/Binary functions ------------------------------ +_lower_doc = """ + Converts a string column to lower case. + + >>> df.select(lower(df.name) ).collect() + [Row(lower(name)=u'alice'), Row(lower(name)=u'bob')] + """ +_upper_doc = """ + Converts a string column to upper case. + + >>> df.select(upper(df.name) ).collect() + [Row(upper(name)=u'ALICE'), Row(upper(name)=u'BOB')] + """ +_reverse_doc = """ + Reverses the string column and returns it as a new string column. + + >>> df.select(reverse(df.name) ).collect() + [Row(reverse(name)=u'ecilA'), Row(reverse(name)=u'boB')] + """ _string_functions = { 'ascii': 'Computes the numeric value of the first character of the string column.', 'base64': 'Computes the BASE64 encoding of a binary column and returns it as a string column.', 'unbase64': 'Decodes a BASE64 encoded string column and returns it as a binary column.', 'initcap': 'Returns a new string column by converting the first letter of each word to ' + 'uppercase. Words are delimited by whitespace.', - 'lower': 'Converts a string column to lower case.', - 'upper': 'Converts a string column to upper case.', - 'reverse': 'Reverses the string column and returns it as a new string column.', + 'lower': _lower_doc, + 'upper': _upper_doc, + 'reverse': _reverse_doc, 'ltrim': 'Trim the spaces from left end for the specified string value.', 'rtrim': 'Trim the spaces from right end for the specified string value.', 'trim': 'Trim the spaces from both ends for the specified string column.', } for _name, _doc in _string_functions.items(): - globals()[_name] = since(1.5)(_create_function(_name, _doc)) + globals()[_name] = since(1.5)(ignore_unicode_prefix(_create_function(_name, _doc))) --- End diff -- I think it is helpful to be clear on how `lower` and `upper` should be used. This week I tried to use `lower` as a column function, rather than as an outside function. I can remove the docstrings if you think avoiding `ignore_unicode_prefix` is important.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org