liukun4515 opened a new issue #1356:
URL: https://github.com/apache/arrow-datafusion/issues/1356


   **Describe the bug**
   In the [Implement DECIMAL 
type](https://github.com/apache/arrow-datafusion/issues/122), I want to 
implement the decimal data type in datafusion.
   
   In the survey period, I take a look the type coercion in the current 
datafusion, and find some confused points.
   In this issue, I want to discuss them.
   
   For example:
   - `AggFunction`
   
   ```
   logical expr:
   agg(input_exprs)
   ```
   
   In the expression evaluation, we need to coercion the expr and calc the 
result type of `ScalarFunction` expr.
   
   In the current code, the logical result type use this 
API[return_type](https://github.com/apache/arrow-datafusion/blob/645a7f484435d7182d88a541ac8cdf8b079b7714/datafusion/src/physical_plan/aggregates.rs#L97),
 but get the physical expr result type use this 
API[create_agg_expr](https://github.com/apache/arrow-datafusion/blob/645a7f484435d7182d88a541ac8cdf8b079b7714/datafusion/src/physical_plan/aggregates.rs#L121).
   
   These two API have a gap, which is `coerce`. In the `coerce`, the input expr 
may be added `try_cast` and change the data type, so the inferred result data 
type may be diff with the logical result data type.
   
   
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to