cloud-fan commented on code in PR #38151:
URL: https://github.com/apache/spark/pull/38151#discussion_r991748642
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/CharVarcharCodegenUtils.java:
##########
@@ -52,4 +52,15 @@ public static UTF8String
varcharTypeWriteSideCheck(UTF8String inputStr, int limi
return trimTrailingSpaces(inputStr, numChars, limit);
}
}
+
+ public static UTF8String readSidePadding(UTF8String inputStr, int limit) {
+ int numChars = inputStr.numChars();
+ if (numChars == limit) {
+ return inputStr;
+ } else if (numChars < limit) {
+ return inputStr.rpad(limit, SPACE);
+ } else {
+ return inputStr;
Review Comment:
We have tests for it, and I didn't add length check to match VARCHAR. Note:
we add can read-side length check for both CHAR and VARCHAR, but that's bad for
perf as VARCHAR is common.
--
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]