snuyanzin commented on code in PR #21993:
URL: https://github.com/apache/flink/pull/21993#discussion_r1129483531


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/ArrayElementArgumentTypeStrategy.java:
##########
@@ -42,7 +42,7 @@ public Optional<DataType> inferArgumentType(
             CallContext callContext, int argumentPos, boolean throwOnFailure) {
         final ArrayType haystackType =
                 (ArrayType) 
callContext.getArgumentDataTypes().get(0).getLogicalType();
-        final LogicalType haystackElementType = haystackType.getElementType();
+        final LogicalType haystackElementType = 
haystackType.getElementType().copy(true);

Review Comment:
   it shouldn't be always nullable.
   i see 3 cases:
   1. `haystackType.getElementType()` is already nullable => no need for force 
nullable
   2. `haystackType.getElementType()` is not nullable and `needleType` is not 
nullable => no need for force nullable
   3.  `haystackType.getElementType()` is not nullable and `needleType` is 
nullable => need for force nullable.
   
   right now it does some not needed work for the first case and breaks the 2nd 
case
   



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