You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2015/12/05 08:00:17 UTC

[jira] [Commented] (SPARK-12102) Cast a non-nullable struct field to a nullable field during analysis

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

Apache Spark commented on SPARK-12102:
--------------------------------------

User 'dilipbiswal' has created a pull request for this issue:
https://github.com/apache/spark/pull/10156

> Cast a non-nullable struct field to a nullable field during analysis
> --------------------------------------------------------------------
>
>                 Key: SPARK-12102
>                 URL: https://issues.apache.org/jira/browse/SPARK-12102
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Yin Huai
>
> If you try {{sqlContext.sql("select case when 1>0 then struct(1, 2, 3, cast(hash(4) as int)) else struct(1, 2, 3, 4) end").printSchema}}, you will see {{org.apache.spark.sql.AnalysisException: cannot resolve 'CASE WHEN (1 > 0) THEN struct(1,2,3,cast(HiveGenericUDF#org.apache.hadoop.hive.ql.udf.generic.GenericUDFHash(4) as int)) ELSE struct(1,2,3,4)' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 85}}.
> The problem is the nullability difference between {{4}} (non-nullable) and {{hash(4)}} (nullable).
> Seems it makes sense to cast the nullability in the analysis. 



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