Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talk about the result type for coerced type #1418

Closed
liukun4515 opened this issue Dec 8, 2021 · 2 comments · Fixed by #1408
Closed

Talk about the result type for coerced type #1418

liukun4515 opened this issue Dec 8, 2021 · 2 comments · Fixed by #1408
Labels
enhancement New feature or request

Comments

@liukun4515
Copy link
Contributor

liukun4515 commented Dec 8, 2021

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In the #122 and #1356, I add new datatype(decimal) and propose a more clear coercion rule for expr system.
When I add decimal to the SUM and AVG function #1408 , I meet some problem.
It's about the returned data type.

For example:
https://github.com/apache/arrow-datafusion/blob/415c5e124af18a05500514f78604366d860dcf5a/datafusion/src/physical_plan/expressions/sum.rs#L49 for floating-point datatype, the pg use the double-precision(double/float64) as the returned data type, but the datafusion is different.

There may be other different rules in spark

Which rule should we follow? For example sum and avg?
@alamb @houqp

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@alamb
Copy link
Contributor

alamb commented Dec 9, 2021

@liukun4515 -- I think the rationale for using float64 for the result of sum(float32) and avg(float32) is done to minimize error due to floating point rounding

I think using float64 for the result type makes sense

@liukun4515
Copy link
Contributor Author

I think using float64 for the result type makes sense

Do you mean to change this line https://github.com/apache/arrow-datafusion/blob/415c5e124af18a05500514f78604366d860dcf5a/datafusion/src/physical_plan/expressions/sum.rs#L57 and return FLOAT64 for sum(float32)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants