matriv commented on a change in pull request #18063:
URL: https://github.com/apache/flink/pull/18063#discussion_r767548841
##########
File path:
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/ArrayToStringCastRule.java
##########
@@ -91,74 +121,94 @@ protected String generateCodeBlockInternal(
context.declareClassField(
className(StringBuilder.class), builderTerm,
constructorCall(StringBuilder.class));
- return new CastRuleUtils.CodeWriter()
- .stmt(methodCall(builderTerm, "setLength", 0))
- .stmt(methodCall(builderTerm, "append", strLiteral("[")))
- .forStmt(
- methodCall(inputTerm, "size"),
- (indexTerm, loopBodyWriter) -> {
- String elementTerm = newName("element");
- String elementIsNullTerm =
newName("elementIsNull");
+ final String resultStringTerm = newName("resultString");
+ final int precision = LogicalTypeChecks.getLength(targetLogicalType);
Review comment:
Imho, that is confusing, because it's called `precision` on the type
(CHAR and VARCHAR) and `length` should be used for actual length of the current
value processed, what do you think?
--
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]