goldmedal commented on issue #10688:
URL: https://github.com/apache/datafusion/issues/10688#issuecomment-2137807135

   I wanted to share something I found. I tried to observe the plan 
transformation step by step: 
   sql_to_plan -> analyze -> optimize
   ```
   SQL: select 128.2 union all select 128.2::float
   ********
   Original LogicalPlan:
    Union
     Projection: Float64(128.2) AS Float64(128.2)
       EmptyRelation
     Projection: CAST(CAST(Float64(128.2) AS Float32) AS Float64) AS 
Float64(128.2)
       EmptyRelation
   ********
   Do some analyze:
    Union
     Projection: Float64(128.2) AS Float64(128.2)
       EmptyRelation
     Projection: CAST(CAST(Float64(128.2) AS Float32) AS Float64) AS 
Float64(128.2)
       EmptyRelation
   ********
   Do some optimize:
    Union
     Projection: Float64(128.2) AS Float64(128.2)
       EmptyRelation
     Projection: Float64(128.1999969482422) AS Float64(128.2)
       EmptyRelation
   ********
   ```
   
   I found that `CAST` is removed after the plan is optimized. I'm not sure 
which optimization rule does this—maybe `unwrap_cast_in_comparison.rs`? I'm not 
sure. I'll keep tracking it tomorrow.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to