Skip to content

Commit 914ed06

Browse files
committed
681: only space character is considered as trailing whitespace
1 parent a3760c2 commit 914ed06

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/df-builtins/src/rtrimmed_length.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl ScalarUDFImpl for RTrimmedLengthFunc {
5757

5858
let new_array = strs
5959
.iter()
60-
.map(|array_elem| array_elem.map(|value| value.trim_end().len() as u64))
60+
.map(|array_elem| array_elem.map(|value| value.trim_end_matches(' ').len() as u64))
6161
.collect::<UInt64Array>();
6262

6363
Ok(ColumnarValue::Array(Arc::new(new_array)))
@@ -89,6 +89,8 @@ mod tests {
8989
(' '),
9090
(''),
9191
('ABC'),
92+
(E'ABCDEFGH \t'),
93+
(E'ABCDEFGH \n'),
9294
(NULL);
9395
";
9496
ctx.sql(insert).await?.collect().await?;
@@ -107,6 +109,8 @@ mod tests {
107109
"| 0 |",
108110
"| 0 |",
109111
"| 3 |",
112+
"| 11 |",
113+
"| 11 |",
110114
"| |",
111115
"+---------------------------------+",
112116
],

0 commit comments

Comments
 (0)