matriv commented on a change in pull request #18063:
URL: https://github.com/apache/flink/pull/18063#discussion_r765792019



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/CastRuleUtils.java
##########
@@ -163,6 +166,25 @@ static String binaryWriterWriteNull(
         return CodeGenUtils.binaryWriterWriteNull(indexTerm, writerTerm, 
logicalType);
     }
 
+    static String lengthExceedsPrecision(String strTerm, int precision) {
+        return methodCall(strTerm, "length") + " > " + precision;
+    }
+
+    /**
+     * For complex types such as {@link LogicalTypeRoot#ARRAY}, use {@link 
VarCharType#STRING_TYPE}
+     * to avoid trimming/padding when casting the inner elements to a {@link
+     * LogicalTypeRoot#VARCHAR} or {@link LogicalTypeRoot#CHAR}.
+     */
+    static LogicalType getLogicalTypeForInnerCast(LogicalType logicalType) {
+        return logicalType.is(LogicalTypeFamily.CHARACTER_STRING)
+                ? VarCharType.STRING_TYPE
+                : logicalType;
+    }

Review comment:
       It was more of "safety net" but you're right we don't need it at all, I 
will directly call underlying code gen with `STRING_TYPE`




-- 
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]


Reply via email to