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

guowei commented on SPARK-5710:
-------------------------------

How about limit merging adjacent casts that are only added in 
`typeCoercionRules` ?
We can add a label in `cast` to  mark them which are added in 
`typeCoercionRules`.

> Combines two adjacent `Cast` expressions into one
> -------------------------------------------------
>
>                 Key: SPARK-5710
>                 URL: https://issues.apache.org/jira/browse/SPARK-5710
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.2.1
>            Reporter: guowei
>            Priority: Minor
>
> A plan after `analyzer` with `typeCoercionRules` may produce many `cast` 
> expressions. we can combine the adjacent ones.
> For example. 
> create table test(a decimal(3,1));
> explain select * from test where a*2-1>1;
> == Physical Plan ==
> Filter (CAST(CAST((CAST(CAST((CAST(a#5, DecimalType()) * 2), 
> DecimalType(21,1)), DecimalType()) - 1), DecimalType(22,1)), DecimalType()) > 
> 1)
>  HiveTableScan [a#5], (MetastoreRelation default, test, None), None



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

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

Reply via email to