-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-49889][PYTHON] Add argument trim for functionstrim/ltrim/rtrim
#48363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -4061,7 +4061,14 @@ object functions { | |||
| * @group string_funcs | ||||
| * @since 2.3.0 | ||||
| */ | ||||
| def ltrim(e: Column, trimString: String): Column = Column.fn("ltrim", lit(trimString), e) | ||||
| def ltrim(e: Column, trimString: String): Column = ltrim(e, lit(trimString)) | ||||
|
|
||||
| /** | ||||
| * Trim the specified character string from left end for the specified string column. | ||||
| * @group string_funcs | ||||
| * @since 4.0.0 | ||||
| */ | ||||
| def ltrim(e: Column, trim: Column): Column = Column.fn("ltrim", trim, e) | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unfortanately, the argument names were already not consistent between python and scala, in many functions. in this PR I use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark/python/pyspark/sql/functions/builtin.py Line 13399 in 78135dc
|
||||
|
|
||||
| /** | ||||
| * Calculates the byte length for the specified string column. | ||||
|
|
@@ -4258,7 +4265,14 @@ object functions { | |||
| * @group string_funcs | ||||
| * @since 2.3.0 | ||||
| */ | ||||
| def rtrim(e: Column, trimString: String): Column = Column.fn("rtrim", lit(trimString), e) | ||||
| def rtrim(e: Column, trimString: String): Column = rtrim(e, lit(trimString)) | ||||
|
|
||||
| /** | ||||
| * Trim the specified character string from right end for the specified string column. | ||||
| * @group string_funcs | ||||
| * @since 4.0.0 | ||||
| */ | ||||
| def rtrim(e: Column, trim: Column): Column = Column.fn("rtrim", trim, e) | ||||
|
|
||||
| /** | ||||
| * Returns the soundex code for the specified expression. | ||||
|
|
@@ -4444,7 +4458,14 @@ object functions { | |||
| * @group string_funcs | ||||
| * @since 2.3.0 | ||||
| */ | ||||
| def trim(e: Column, trimString: String): Column = Column.fn("trim", lit(trimString), e) | ||||
| def trim(e: Column, trimString: String): Column = trim(e, lit(trimString)) | ||||
|
|
||||
| /** | ||||
| * Trim the specified character from both ends for the specified string column. | ||||
| * @group string_funcs | ||||
| * @since 4.0.0 | ||||
| */ | ||||
| def trim(e: Column, trim: Column): Column = Column.fn("trim", trim, e) | ||||
|
|
||||
| /** | ||||
| * Converts a string column to upper case. | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is kind of confusing on the arg order here:
1, connect:
_invoke_function_over_columns("ltrim", trim, col)-> follow the order in constructorspark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
Line 1507 in d85e7bc
2, classic:
_invoke_function_over_columns("ltrim", col, trim)follows the signature in scala functionsUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably we can unify the function invocations of both connect and classic in some way