This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
[NSE-207] fix unsuppored types in aggregate #299
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zhouyuan
reviewed
May 10, 2021
@rui-mo C++ unit tests need to be refreshed? |
zhouyuan
reviewed
May 10, 2021
native-sql-engine/cpp/src/codegen/arrow_compute/ext/actions_impl.cc
Outdated
Show resolved
Hide resolved
zhouyuan
reviewed
May 26, 2021
@@ -1977,6 +2316,183 @@ class AvgAction : public ActionBase { | |||
uint64_t length_ = 0; | |||
}; | |||
|
|||
// Decimal | |||
template <typename DataType, typename CType, typename ResDataType, typename ResCType> | |||
class AvgAction<DataType, CType, ResDataType, ResCType, |
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.
is AVG on decimal column a valid case? seems on Spark it will cast decimal to long first
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.
It looks like sum could be decimal, count is long type. And average could be decimal type.
private lazy val resultType = child.dataType match {
case DecimalType.Fixed(p, s) =>
DecimalType.bounded(p + 4, s + 4)
case _ => DoubleType
}
private lazy val sumDataType = child.dataType match {
case _ @ DecimalType.Fixed(p, s) => DecimalType.bounded(p + 10, s)
case _ => DoubleType
}
private lazy val sum = AttributeReference("sum", sumDataType)()
private lazy val count = AttributeReference("count", LongType)()
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This pr fixed the unsuppored types in aggregate.
#207
How was this patch tested?
verified on TPC-DS v2, TPC-DS v1