HyukjinKwon commented on a change in pull request #33992:
URL: https://github.com/apache/spark/pull/33992#discussion_r708053772
##########
File path: python/pyspark/sql/functions.py
##########
@@ -3098,6 +3098,48 @@ def length(col):
return Column(sc._jvm.functions.length(_to_java_column(col)))
+def octet_length(col):
+ """
+ .. versionadded:: 3.3.0
+ Parameters
+ ----------
+ col : :class:`~pyspark.sql.Column` or str
+ Source column or strings
+ Returns
+ -------
+ :class:`~pyspark.sql.Column`
+ Byte length of the col
+ Examples
+ -------
+ >>> from pyspark.sql.functions import octet_length
+ >>> spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat']) \
+ .select(octet_length('cat')).collect()
+ [Row(octet_length(cat)=3), Row(octet_length(cat)=4)]
+ """
+ return _invoke_function_over_column("octet_length", col)
+
+
+def bit_length(col):
+ """
+ .. versionadded:: 3.3.0
+ Parameters
Review comment:
Shall we add a short description and add newline before after `..
versionadded:: 3.3.0`? e.g.)
```
"""
Bit length blah blah
.. versionadded:: 3.3.0
Parameters
...
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]