SEPURI-SAI-KRISHNA commented on code in PR #29123:
URL: https://github.com/apache/flink/pull/29123#discussion_r3980388040
##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/ScalarFunctionsTest.scala:
##########
@@ -106,6 +106,26 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
// invalid length
($"f0".overlay("IS", 6, -1), "OVERLAY(f0 PLACING 'IS' FROM 6 FOR -1)",
"This IS"),
+ // a zero length replaces nothing, so the whole tail survives
+ ("abcdef".overlay("X", 2, 0), "OVERLAY('abcdef' PLACING 'X' FROM 2 FOR
0)", "aXbcdef"),
+ ("abcdef".overlay("X", 1, 0), "OVERLAY('abcdef' PLACING 'X' FROM 1 FOR
0)", "Xabcdef"),
+ ("abcdef".overlay("X", 6, 0), "OVERLAY('abcdef' PLACING 'X' FROM 6 FOR
0)", "abcdeXf"),
+
+ // a supplementary-plane character is one character and is never split
into half a pair
Review Comment:
A SQL literal can't hold an unpaired surrogate, it becomes `?` before
execution: `CHAR_LENGTH('a\ud83db')` returns 3 and the value is `a?b`. Cases
written that way would test `'a?b'`.
The function handles them: a lone surrogate counts as one code point,
`overlay("a\ud83db", "X", 1, 1)` gives `X\ud83db`. Only a direct unit test
reaches that, and there's no `SqlFunctionUtils` test class today. Add one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]