[ 
https://issues.apache.org/jira/browse/FLINK-25930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17485890#comment-17485890
 ] 

Marios Trivyzas commented on FLINK-25930:
-----------------------------------------

BTW: those are the failures if we simply remove the 2 lines from 
*ScalarOperatorGens:* 
{noformat}
[ERROR]   
ArrayTypeTest>ExpressionTestBase.evaluateExprs:129->ExpressionTestBase.evaluateGivenExprs:345->ExpressionTestBase.getCodeGenFunction:379->ExpressionTestBase.$anonfun$getCodeGenFunction$3:379
 » CodeGen
[ERROR]   
ScalarFunctionsTest.testOverlaps:3284->ExpressionTestBase.testAllApis:425->ExpressionTestBase.testSqlApi:194->ExpressionTestBase.addSqlTestExpr:299->ExpressionTestBase.addTestExpr:325
 » CodeGen
[ERROR]   
SqlExpressionTest.testDateTimeFunctions:235->ExpressionTestBase.testSqlApi:194->ExpressionTestBase.addSqlTestExpr:299->ExpressionTestBase.addTestExpr:325
 » CodeGen
[ERROR]   
TemporalTypesTest.testTemporalShanghai:1001->ExpressionTestBase.testSqlApi:194->ExpressionTestBase.addSqlTestExpr:299->ExpressionTestBase.addTestExpr:325
 » CodeGen{noformat}
{noformat}
*no* further _formatting_ is done here{noformat}
 

 

> Remove identity casting from ScalarOperatorGens
> -----------------------------------------------
>
>                 Key: FLINK-25930
>                 URL: https://issues.apache.org/jira/browse/FLINK-25930
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Marios Trivyzas
>            Priority: Major
>
> Following: [https://github.com/apache/flink/pull/18582]
> we could remove the following code from {*}ScalarOperatorGens{*}:
>  
>  
> {noformat}
> case (_, _) if isInteroperable(operand.resultType, targetType) =>
> operand.copy(resultType = targetType)
>  
> {noformat}
> and use our *IdentityCastRule* instead but there is an issue.
>  
> Currently the *isInteroperable* allows casting between types with different 
> nullability whereas the *IdentityCastRule* uses the 
> {*}LogicalTypeCasts#{*}{*}supportsAvoidingCast{*} which in turn uses the 
> *CastAvoidanceChecker* which doesn't allow to cast from a nullable type to 
> the same but non-nullable type, i.e. INT -> INT NOT NULL
> {noformat}
> if (sourceType.isNullable() && !targetType.isNullable()
>         || sourceType.getClass() != targetType.getClass()
>         || // TODO drop this line once we remove legacy types
>         sourceType.getTypeRoot() != targetType.getTypeRoot()) {
>     return false;
> }{noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to