findepi commented on PR #13717:
URL: https://github.com/apache/datafusion/pull/13717#issuecomment-2535985246

   > Both of these functions have been part of the public API for a while now. 
   
   i believe you 
   
   > The newer `return_type_from_exprs` works correctly and the older 
`return_type` is incorrect in some cases. It seems better to me to deprecate 
the older incorrect version.
   
   date_part's return_type used to be correct in all cases
   
   the implementation was removed because it was no longer correct in all cases
   
   if someone calls `func.return_type()` just for display purposes into logs, 
they may be OK getting wrong information.
   If someone calls `func.return_type()` and trusts return value, they could be 
disappointed if we continue to return something, but the return value doesn't 
continue to be correct.
   
   for example (pseudo-code)
   
   ```rust
   let func_return_value : ArrayRef =  ... ;
   match func.return_type() {
    case Float64 => {
       as_float64_array(func_return_value) ...
   ```
   
   or 
   
   ```rust
   let wanted_type = ...;
   let ret func.return_type();
   if wanted_type == ret {
     return func
   } else {
     Expr::Cast( func, wanted_type )
   }
   ```
   
   
   
   if we need to return some incorrect value for some time, this should be 
behind an opt-in config toggle. 
   
   
   
   


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