-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sum(distinct)
support
#2405
sum(distinct)
support
#2405
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,6 +297,18 @@ pub(crate) fn sum(lhs: &ScalarValue, rhs: &ScalarValue) -> Result<ScalarValue> { | |
(ScalarValue::Int64(lhs), ScalarValue::Int8(rhs)) => { | ||
typed_sum!(lhs, rhs, Int64, i64) | ||
} | ||
(ScalarValue::Int64(lhs), ScalarValue::UInt64(rhs)) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a fine change in this PR -- though it is strange to me that we have to be doing these casts in sum.rs as it duplicates some non trivial amount of the logic in coercion -- maybe it would be possible to make this code cleaner / consolidate more of the coercion logic. Again, no changes needed for this PR but I figured I would point it out while reading this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @alamb There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coercion u64 to i64 seems irrational to me. Why do we need this kind of coercion in sum distinct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @WinkerDu is just following the same pre-existing pattern with this PR I agree that the pre-existing pattern doesn't make sense to me (it should have already been done by the time the distinct aggregate code is being executed) |
||
typed_sum!(lhs, rhs, Int64, i64) | ||
} | ||
(ScalarValue::Int64(lhs), ScalarValue::UInt32(rhs)) => { | ||
typed_sum!(lhs, rhs, Int64, i64) | ||
} | ||
(ScalarValue::Int64(lhs), ScalarValue::UInt16(rhs)) => { | ||
typed_sum!(lhs, rhs, Int64, i64) | ||
} | ||
(ScalarValue::Int64(lhs), ScalarValue::UInt8(rhs)) => { | ||
typed_sum!(lhs, rhs, Int64, i64) | ||
} | ||
e => { | ||
return Err(DataFusionError::Internal(format!( | ||
"Sum is not expected to receive a scalar {:?}", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍