yaooqinn commented on a change in pull request #31281:
URL: https://github.com/apache/spark/pull/31281#discussion_r562455777
##########
File path:
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/CharVarcharCodegenUtils.java
##########
@@ -22,55 +22,34 @@
public class CharVarcharCodegenUtils {
private static final UTF8String SPACE = UTF8String.fromString(" ");
- /**
- * Trailing spaces do not count in the length check. We don't need to
retain the trailing
- * spaces, as we will pad char type columns/fields at read time.
- */
- public static UTF8String charTypeWriteSideCheck(UTF8String inputStr, int
limit) {
- if (inputStr == null) {
- return null;
+ private static UTF8String trimTrailingSpaces(
+ UTF8String inputStr, int numChars, int limit) {
+ int numTailSpacesToTrim = numChars - limit;
Review comment:
to be safer we can add this assert to UTF8String
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]