You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exec_err!("Unsupported data type {other:?} for function translate")
80
103
}
81
104
}
82
105
}
83
106
84
107
/// Replaces each character in string that matches a character in the from set with the corresponding character in the to set. If from is longer than to, occurrences of the extra characters in from are deleted.
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/string_view.slt
+38-2Lines changed: 38 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -425,6 +425,43 @@ logical_plan
425
425
01)Projection: starts_with(test.column1_utf8view, Utf8View("äöüß")) AS c1, starts_with(test.column1_utf8view, Utf8View("")) AS c2, starts_with(test.column1_utf8view, Utf8View(NULL)) AS c3, starts_with(Utf8View(NULL), test.column1_utf8view) AS c4
426
426
02)--TableScan: test projection=[column1_utf8view]
427
427
428
+
### Test TRANSLATE
429
+
430
+
# Should run TRANSLATE using utf8view column successfully
431
+
query T
432
+
SELECT
433
+
TRANSLATE(column1_utf8view, 'foo', 'bar') as c
434
+
FROM test;
435
+
----
436
+
Andrew
437
+
Xiangpeng
438
+
Raphael
439
+
NULL
440
+
441
+
# Should run TRANSLATE using utf8 column successfully
442
+
query T
443
+
SELECT
444
+
TRANSLATE(column1_utf8, 'foo', 'bar') as c
445
+
FROM test;
446
+
----
447
+
Andrew
448
+
Xiangpeng
449
+
Raphael
450
+
NULL
451
+
452
+
# Should run TRANSLATE using large_utf8 column successfully
453
+
query T
454
+
SELECT
455
+
TRANSLATE(column1_large_utf8, 'foo', 'bar') as c
456
+
FROM test;
457
+
----
458
+
Andrew
459
+
Xiangpeng
460
+
Raphael
461
+
NULL
462
+
463
+
464
+
428
465
### Initcap
429
466
430
467
query TT
@@ -1047,14 +1084,13 @@ logical_plan
1047
1084
02)--TableScan: test projection=[column1_utf8view, column2_utf8view]
1048
1085
1049
1086
## Ensure no casts for TRANSLATE
1050
-
## TODO file ticket
1051
1087
query TT
1052
1088
EXPLAIN SELECT
1053
1089
TRANSLATE(column1_utf8view, 'foo', 'bar') as c
1054
1090
FROM test;
1055
1091
----
1056
1092
logical_plan
1057
-
01)Projection: translate(CAST(test.column1_utf8view AS Utf8), Utf8("foo"), Utf8("bar")) AS c
1093
+
01)Projection: translate(test.column1_utf8view, Utf8("foo"), Utf8("bar")) AS c
1058
1094
02)--TableScan: test projection=[column1_utf8view]
0 commit comments