Commit fc4b49c
[SPARK-31503][SQL] fix the SQL string of the TRIM functions
### What changes were proposed in this pull request?
override the `sql` method of `StringTrim`, `StringTrimLeft` and `StringTrimRight`, to use the standard SQL syntax.
### Why are the changes needed?
The current implementation is wrong. It gives you a SQL string that returns different result.
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
new tests
Closes #28281 from cloud-fan/sql.
Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit b209b5f)
Signed-off-by: Dongjoon Hyun <[email protected]>1 parent c5eac36 commit fc4b49c
4 files changed
Lines changed: 34 additions & 25 deletions
File tree
- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions
- core/src/test/resources/sql-tests
- inputs
- results
- postgreSQL
Lines changed: 15 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
686 | 691 | | |
687 | 692 | | |
688 | 693 | | |
689 | 694 | | |
690 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
691 | 702 | | |
692 | 703 | | |
693 | 704 | | |
| |||
769 | 780 | | |
770 | 781 | | |
771 | 782 | | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
| 783 | + | |
| 784 | + | |
777 | 785 | | |
778 | 786 | | |
779 | 787 | | |
| |||
865 | 873 | | |
866 | 874 | | |
867 | 875 | | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
| 876 | + | |
873 | 877 | | |
874 | 878 | | |
875 | 879 | | |
| |||
964 | 968 | | |
965 | 969 | | |
966 | 970 | | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
| 971 | + | |
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
980 | | - | |
| 980 | + | |
981 | 981 | | |
982 | 982 | | |
983 | 983 | | |
| |||
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
207 | 215 | | |
208 | 216 | | |
209 | 217 | | |
210 | | - | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
218 | | - | |
| 226 | + | |
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
226 | | - | |
| 234 | + | |
227 | 235 | | |
228 | 236 | | |
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
232 | 240 | | |
233 | 241 | | |
234 | | - | |
| 242 | + | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
240 | 248 | | |
241 | 249 | | |
242 | | - | |
| 250 | + | |
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
246 | 254 | | |
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
250 | | - | |
| 258 | + | |
251 | 259 | | |
252 | 260 | | |
253 | 261 | | |
254 | 262 | | |
255 | 263 | | |
256 | 264 | | |
257 | 265 | | |
258 | | - | |
| 266 | + | |
259 | 267 | | |
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
266 | | - | |
| 274 | + | |
267 | 275 | | |
268 | 276 | | |
0 commit comments