Skip to content

Conversation

@xuzifu666
Copy link
Member

Purpose

Linked issue: close #xxx

The trim function are frequently used. This PR supports trim/ltrim/rtrim functions pushdown in Spark side.

Note the automatic conversion in Spark, as follows:
trim(leading 'abc' from b) => ltrim('abc', b)
trim(tailing 'abc' from b) => rtrim('abc', b)
trim(both 'abc' from b) => trim('abc', b)

Tests

API and Format

Documentation

Generative AI tooling

}

public static String trim(String value, String charsToTrim) {
if (value == null || charsToTrim == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless if, remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reminder,Done.


public static final String RTRIM = "RTRIM";

private final String trimWay;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create an enum Flag in this class. And values LEADING, TRAILING, BOTH.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants