You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "黄海升 (Jira)" <ji...@apache.org> on 2021/01/09 08:10:00 UTC

[jira] [Commented] (SPARK-25039) Binary comparison behavior should refer to Teradata

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

黄海升 commented on SPARK-25039:
-----------------------------

 It is necessary that converting `StringType` value and `{{NumericType}}` value to `DoubleType` value.

Here's an example:

```

'999999999999999999' > 0 ==>

cast('999999999999999999' as Int) > 0 ==>

null > 0 ==>

false

```

> Binary comparison behavior should refer to Teradata
> ---------------------------------------------------
>
>                 Key: SPARK-25039
>                 URL: https://issues.apache.org/jira/browse/SPARK-25039
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.1.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> The main difference is:
> # When comparing a {{StringType}} value with a {{NumericType}} value, Spark converts the {{StringType}} data to a {{NumericType}} value. But Teradata converts the {{StringType}} data to a {{DoubleType}} value.
> # When comparing a {{StringType}} value with a {{DateType}} value, Spark converts the {{DateType}} data to a {{StringType}} value. But Teradata converts the {{StringType}} data to a {{DateType}} value.
>  
> More details:
> https://github.com/apache/spark/blob/65a4bc143ab5dc2ced589dc107bbafa8a7290931/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala#L120-L149
> https://www.info.teradata.com/HTMLPubs/DB_TTU_16_00/index.html#page/SQL_Reference/B035-1145-160K/lrn1472241011038.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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