This is an automated email from the ASF dual-hosted git repository.

mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 239d8b20f57d3c86a2a23657d522671e7d55ce78
Author: Mihai Budiu <[email protected]>
AuthorDate: Fri Nov 1 13:15:08 2024 -0700

    NlsString.rtrim should only trim at the right
    
    Signed-off-by: Mihai Budiu <[email protected]>
---
 core/src/main/java/org/apache/calcite/util/NlsString.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/util/NlsString.java 
b/core/src/main/java/org/apache/calcite/util/NlsString.java
index 24d110ebd5..e4e9d8e632 100644
--- a/core/src/main/java/org/apache/calcite/util/NlsString.java
+++ b/core/src/main/java/org/apache/calcite/util/NlsString.java
@@ -229,19 +229,19 @@ public class NlsString implements Comparable<NlsString>, 
Cloneable {
 
   /**
    * Returns a string the same as this but with spaces trimmed from the
-   * right such that the result has the specified size.
+   * right.  The result is never shorter than minResultSize.
    *
-   * @param resultSize Expected size for result string.  If negative, it 
indicates
+   * @param minResultSize Expected size for result string.  If negative, it 
indicates
    *                   that no trimming should be done.
    */
-  public NlsString rtrim(int resultSize) {
+  public NlsString rtrim(int minResultSize) {
     String value = getValue();
-    if (value.length() <= resultSize || resultSize < 0) {
+    if (value.length() <= minResultSize || minResultSize < 0) {
       return this;
     }
-    String left = value.substring(0, resultSize);
-    String right = value.substring(resultSize);
-    String trimmed = SqlFunctions.rtrim(left + right.trim());
+    String left = value.substring(0, minResultSize);
+    String right = value.substring(minResultSize);
+    String trimmed = left + SqlFunctions.rtrim(right);
     if (!trimmed.equals(value)) {
       return new NlsString(trimmed, charsetName, collation);
     }

Reply via email to