You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/04/13 00:31:25 UTC

[jira] [Updated] (SPARK-14580) HiveTypeCoercion.IfCoercion should preserve original predicates.

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

Dongjoon Hyun updated SPARK-14580:
----------------------------------
    Description: 
Currently, `HiveTypeCoercion.IfCoercion` removes all predicates whose return-type is null. However, some UDFs need evaluations because they are designed to throw exceptions.
*Hive*
{code}
hive> select if(assert_true(false),2,3);
OK
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: ASSERT_TRUE(): assertion failed.
{code}
    
*Spark*
{code}
scala> sql("select if(assert_true(false),2,3)").head
res2: org.apache.spark.sql.Row = [3]
{code}

`IfCoercion` works like the followings.
{code}
=== Applying Rule org.apache.spark.sql.catalyst.analysis.HiveTypeCoercion$IfCoercion ===
!'Project [unresolvedalias(if (HiveGenericUDF#org.apache.hadoop.hive.ql.udf.generic.GenericUDFAssertTrue(false)) 2 else 3)]   'Project [unresolvedalias(if (nu
ll) 2 else 3)]
 +- OneRowRelation$                                                                                                           +- OneRowRelation$      
{code}


  was:
Currently, `HiveTypeCoercion.IfCoercion` removes all predicates whose return-type is null. However, some UDFs need evaluations because they are designed to throw exceptions.
*Hive*
{code}
hive> select if(assert_true(false),2,3);
OK
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: ASSERT_TRUE(): assertion failed.
{code}
    
*Before*
{code}
scala> sql("select if(assert_true(false),2,3)").head
res2: org.apache.spark.sql.Row = [3]
{code}

`IfCoercion` works like the followings.
{code}
=== Applying Rule org.apache.spark.sql.catalyst.analysis.HiveTypeCoercion$IfCoercion ===
!'Project [unresolvedalias(if (HiveGenericUDF#org.apache.hadoop.hive.ql.udf.generic.GenericUDFAssertTrue(false)) 2 else 3)]   'Project [unresolvedalias(if (nu
ll) 2 else 3)]
 +- OneRowRelation$                                                                                                           +- OneRowRelation$      
{code}



> HiveTypeCoercion.IfCoercion should preserve original predicates.
> ----------------------------------------------------------------
>
>                 Key: SPARK-14580
>                 URL: https://issues.apache.org/jira/browse/SPARK-14580
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1, 2.0.0
>            Reporter: Dongjoon Hyun
>
> Currently, `HiveTypeCoercion.IfCoercion` removes all predicates whose return-type is null. However, some UDFs need evaluations because they are designed to throw exceptions.
> *Hive*
> {code}
> hive> select if(assert_true(false),2,3);
> OK
> Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: ASSERT_TRUE(): assertion failed.
> {code}
>     
> *Spark*
> {code}
> scala> sql("select if(assert_true(false),2,3)").head
> res2: org.apache.spark.sql.Row = [3]
> {code}
> `IfCoercion` works like the followings.
> {code}
> === Applying Rule org.apache.spark.sql.catalyst.analysis.HiveTypeCoercion$IfCoercion ===
> !'Project [unresolvedalias(if (HiveGenericUDF#org.apache.hadoop.hive.ql.udf.generic.GenericUDFAssertTrue(false)) 2 else 3)]   'Project [unresolvedalias(if (nu
> ll) 2 else 3)]
>  +- OneRowRelation$                                                                                                           +- OneRowRelation$      
> {code}



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