[
https://issues.apache.org/jira/browse/SPARK-16646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15385760#comment-15385760
]
Hyukjin Kwon commented on SPARK-16646:
--------------------------------------
Just FYI, I just tried to reproduce this.
In 1.6.x, in HiveContext the codes below:
{code}
SELECT LEAST(1, 1.5)
{code}
casts 1.5 as double. So, here,
https://github.com/apache/spark/blob/162d04a30e38bb83d35865679145f8ea80b84c26/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala#L506-L508
this finds a tightest common type from both {{IntegerType}} and {{DoubleType}}
as {{DoubleType}}, then it works okay.
But in master branach,
It casts 1.5 as decimal(2, 1). So, it fails to find a tightest common type
from both {{IntegerType}} and {{DecimalType(2, 1)}}.
> LEAST doesn't accept numeric arguments with different data types
> ----------------------------------------------------------------
>
> Key: SPARK-16646
> URL: https://issues.apache.org/jira/browse/SPARK-16646
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.0
> Reporter: liancheng
>
> {code:sql}
> SELECT LEAST(1, 1.5);
> {code}
> {noformat}
> Error: org.apache.spark.sql.AnalysisException: cannot resolve 'least(1,
> CAST(2.1 AS DECIMAL(2,1)))' due to data type mismatch: The expressions should
> all have the same type, got LEAST (ArrayBuffer(IntegerType,
> DecimalType(2,1))).; line 1 pos 7 (state=,code=0)
> {noformat}
> This query works for 1.6.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]