dawidwys commented on a change in pull request #12593:
URL: https://github.com/apache/flink/pull/12593#discussion_r439362209



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeStrategies.java
##########
@@ -315,6 +330,32 @@ public static TypeStrategy nullable(TypeStrategy 
initialStrategy) {
                return Optional.of(fromLogicalToDataType(inferredType));
        };
 
+       /**
+        * Type strategy that returns the type of a string concatenation. It 
assumes that the first two
+        * arguments are of the same family of either {@link 
LogicalTypeFamily#BINARY_STRING} or
+        * {@link LogicalTypeFamily#CHARACTER_STRING}.
+        */
+       public static final TypeStrategy STRING_CONCAT = callContext -> {
+               final List<DataType> argumentDataTypes = 
callContext.getArgumentDataTypes();
+               final LogicalType type1 = 
argumentDataTypes.get(0).getLogicalType();
+               final LogicalType type2 = 
argumentDataTypes.get(1).getLogicalType();
+               int length = getLength(type1) + getLength(type2);
+               if (length < 0) {

Review comment:
       nit: add a comment //overflow




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to