raminqaf commented on code in PR #28758:
URL: https://github.com/apache/flink/pull/28758#discussion_r3628412665
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/VariantToStringCastRule.java:
##########
@@ -45,6 +51,6 @@ public String generateStringExpression(
String inputTerm,
LogicalType inputLogicalType,
LogicalType targetLogicalType) {
- return methodCall(inputTerm, "toString");
+ return staticCall(VariantCastUtils.class, "toStringValue", inputTerm);
Review Comment:
when the target is bounded `CHAR(n)/VARCHAR(n)`,
`CharVarCharTrimPadCastRule` kicks in, calls the `variant→string` rule, and
trims/pads — the identical path every other to-string cast uses.
I added tests to prove it, and they pass:
- CAST(PARSE_JSON('"foobar"') AS VARCHAR(3)) → foo (trimmed)
- CAST(PARSE_JSON('"ab"') AS CHAR(5)) → ab (padded)
--
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]