You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Priyanka Garg (JIRA)" <ji...@apache.org> on 2016/10/24 06:13:58 UTC

[jira] [Updated] (SPARK-18048) If expression behaves differently if true and false expression are interchanged in case of different data types.

     [ https://issues.apache.org/jira/browse/SPARK-18048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Priyanka Garg updated SPARK-18048:
----------------------------------
    Description: 
If expression behaves differently if true and false expression are interchanged in case of different data types.

For eg. 
If(Literal.create(geo != null, BooleanType),
        Literal.create(null, DateType),
        Literal.create(null, TimestampType)) is throwing error while 

If(Literal.create(geo != null, BooleanType),
        Literal.create(null, TimestampType),
        Literal.create(null, DateType )) works fine.

The reason for the same is that the If expression 's datatype only considers trueValue.dataType.

Also, 
If(Literal.create(geo != null, BooleanType),
        Literal.create(null, DateType),
        Literal.create(null, TimestampType))
 is breaking only in case of Generated mutable Projection and Unsafe projection. For all other types its working fine.

Either both should work or none should work

  was:
If expression behaves differently if true and false expression are interchanged in case of different data types.

For eg. 
If(Literal.create(geo != null, BooleanType),
        Literal.create(null, DateType),
        Literal.create(null, TimestampType)) is throwing error while 

If(Literal.create(geo != null, BooleanType),
        Literal.create(null, TimestampType),
        Literal.create(null, DateType )) works fine.

The reason for the same is that the If expression 's datatype only considers trueValue.dataType.

Also, 
If(Literal.create(geo != null, BooleanType),
        Literal.create(null, DateType),
        Literal.create(null, TimestampType))
 is breaking only in case of Generated mutable Projection and Unsafe projection. For all other types its working fine.


> If expression behaves differently if true and false expression are interchanged in case of different data types.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-18048
>                 URL: https://issues.apache.org/jira/browse/SPARK-18048
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Priyanka Garg
>
> If expression behaves differently if true and false expression are interchanged in case of different data types.
> For eg. 
> If(Literal.create(geo != null, BooleanType),
>         Literal.create(null, DateType),
>         Literal.create(null, TimestampType)) is throwing error while 
> If(Literal.create(geo != null, BooleanType),
>         Literal.create(null, TimestampType),
>         Literal.create(null, DateType )) works fine.
> The reason for the same is that the If expression 's datatype only considers trueValue.dataType.
> Also, 
> If(Literal.create(geo != null, BooleanType),
>         Literal.create(null, DateType),
>         Literal.create(null, TimestampType))
>  is breaking only in case of Generated mutable Projection and Unsafe projection. For all other types its working fine.
> Either both should work or none should work



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org