Commit 80588e4
[SPARK-32559][SQL] Fix the trim logic did't handle ASCII control characters correctly
### What changes were proposed in this pull request?
The trim logic in Cast expression introduced in #29375 trim ASCII control characters unexpectly.
Before this patch

And hive

### Why are the changes needed?
The behavior described above doesn't consistent with the behavior of Hive
### Does this PR introduce _any_ user-facing change?
Yes
### How was this patch tested?
add ut
Closes #41535 from Kwafoor/trim_bugfix.
Lead-authored-by: wangjunbo <wangjunbo@qiyi.com>
Co-authored-by: Junbo wang <1042815068@qq.com>
Signed-off-by: Kent Yao <yao@apache.org>1 parent 37ab190 commit 80588e4
3 files changed
Lines changed: 22 additions & 6 deletions
File tree
- common/unsafe/src
- main/java/org/apache/spark/unsafe/types
- test/java/org/apache/spark/unsafe/types
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
502 | 510 | | |
503 | 511 | | |
504 | 512 | | |
| |||
535 | 543 | | |
536 | 544 | | |
537 | 545 | | |
538 | | - | |
| 546 | + | |
539 | 547 | | |
540 | 548 | | |
541 | 549 | | |
542 | 550 | | |
543 | 551 | | |
544 | 552 | | |
545 | | - | |
| 553 | + | |
546 | 554 | | |
547 | 555 | | |
548 | 556 | | |
| |||
1131 | 1139 | | |
1132 | 1140 | | |
1133 | 1141 | | |
1134 | | - | |
| 1142 | + | |
1135 | 1143 | | |
1136 | 1144 | | |
1137 | 1145 | | |
1138 | | - | |
| 1146 | + | |
1139 | 1147 | | |
1140 | 1148 | | |
1141 | 1149 | | |
| |||
1228 | 1236 | | |
1229 | 1237 | | |
1230 | 1238 | | |
1231 | | - | |
| 1239 | + | |
1232 | 1240 | | |
1233 | 1241 | | |
1234 | 1242 | | |
1235 | | - | |
| 1243 | + | |
1236 | 1244 | | |
1237 | 1245 | | |
1238 | 1246 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
| |||
0 commit comments