This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 0e806609fe2e70c98ef578571a11a857cf2f69fd
Author: Timo Walther <[email protected]>
AuthorDate: Mon Jun 15 15:30:31 2020 +0200

    [hotfix][table-common] Relax literal casting check in AdaptedCallContext
---
 .../flink/table/types/inference/utils/AdaptedCallContext.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/utils/AdaptedCallContext.java
 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/utils/AdaptedCallContext.java
index 01700f6..c938d5c 100644
--- 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/utils/AdaptedCallContext.java
+++ 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/utils/AdaptedCallContext.java
@@ -23,6 +23,7 @@ import org.apache.flink.table.catalog.DataTypeFactory;
 import org.apache.flink.table.functions.FunctionDefinition;
 import org.apache.flink.table.types.DataType;
 import org.apache.flink.table.types.inference.CallContext;
+import org.apache.flink.table.types.logical.LogicalType;
 import org.apache.flink.util.Preconditions;
 
 import javax.annotation.Nullable;
@@ -30,6 +31,8 @@ import javax.annotation.Nullable;
 import java.util.List;
 import java.util.Optional;
 
+import static 
org.apache.flink.table.types.logical.utils.LogicalTypeCasts.supportsAvoidingCast;
+
 /**
  * Helper context that deals with adapted arguments.
  *
@@ -104,6 +107,8 @@ public final class AdaptedCallContext implements 
CallContext {
        }
 
        private boolean isCasted(int pos) {
-               return 
!originalContext.getArgumentDataTypes().get(pos).equals(expectedArguments.get(pos));
+               final LogicalType originalType = 
originalContext.getArgumentDataTypes().get(pos).getLogicalType();
+               final LogicalType expectedType = 
expectedArguments.get(pos).getLogicalType();
+               return !supportsAvoidingCast(originalType, expectedType);
        }
 }

Reply via email to