-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for Decimal Type Sum Aggregation #2163
Conversation
4841bbd
to
05301ee
Compare
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.
@majetideepak Overall looks good. Some comments below.
velox/type/ShortDecimal.h
Outdated
struct ShortDecimal { | ||
public: | ||
// Default required for creating vector with NULL values. | ||
ShortDecimal() = default; | ||
constexpr explicit ShortDecimal(int64_t value) : unscaledValue_(value) {} | ||
constexpr ShortDecimal(int64_t value) : unscaledValue_(value) {} |
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.
I think you still need 'explicit'
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.
My idea was to allow all integer types to implicitly cast to ShortDecimal and LongDecimal.
I can add explicit constructors if that is a best practice.
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.
Why would we want to implicitly cast any integer to a decimal? XxxDecimal classes are a bit weird as they hold unscaled values which cannot be properly interpreted without extract information about scale. Implicitly casing an integer to XxxDecimal produces a value that is not equal to the original integer unless scale of 0 is assumed. I wonder if renaming these classes to UnscaledXxxDecimal would make the code a bit clearer.
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.
My interpretation is that in the input to XxxDecimal are always unscaled values as there is no precision, scale info like you said. But I see your view as well. I guess renaming to UnscaledXxxDecimal clarifies this and we can allow implicit integer cast to UnscaledXxxDecimal.
I will make this change in a separate PR.
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.
CC: @karteekmurthys
velox/type/ShortDecimal.h
Outdated
struct ShortDecimal { | ||
public: | ||
// Default required for creating vector with NULL values. | ||
ShortDecimal() = default; | ||
constexpr explicit ShortDecimal(int64_t value) : unscaledValue_(value) {} | ||
constexpr ShortDecimal(int64_t value) : unscaledValue_(value) {} |
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.
nit: Add empty lines between methods.
velox/type/ShortDecimal.h
Outdated
struct ShortDecimal { | ||
public: | ||
// Default required for creating vector with NULL values. | ||
ShortDecimal() = default; | ||
constexpr explicit ShortDecimal(int64_t value) : unscaledValue_(value) {} | ||
constexpr ShortDecimal(int64_t value) : unscaledValue_(value) {} | ||
ShortDecimal(LongDecimal& value); |
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.
What is this constructor for? Is it valid to create a short decimal value from a long decimal value?
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.
This is required for the sum aggregate template setup. The initialization 0
is a LongDecimal which gets passed as a ShortDecimal value. I added a check to ensure validity.
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.
We can specialize there if needed. But I thought this won't hurt as long as there is a validity check.
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 it this code?
*exec::Aggregate::value<ResultType>(groups[i]) = 0;
Can it be changed to = ResultType(0)
?
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.
The issue is with the template parameter types
velox/velox/functions/prestosql/aggregates/SimpleNumericAggregate.h
Lines 130 to 151 in 717c5a9
template < | |
typename TData = TResult, | |
typename UpdateSingle, | |
typename UpdateDuplicate> | |
void updateOneGroup( | |
char* group, | |
const SelectivityVector& rows, | |
const VectorPtr& arg, | |
UpdateSingle updateSingleValue, | |
UpdateDuplicate updateDuplicateValues, | |
bool /*mayPushdown*/, | |
TData initialValue) { | |
DecodedVector decoded(*arg, rows); | |
// Do row by row if not all rows are selected. | |
if (decoded.isConstantMapping()) { | |
if (!decoded.isNullAt(0)) { | |
updateDuplicateValues( | |
initialValue, decoded.valueAt<TInput>(0), rows.countSelected()); | |
updateNonNullValue<true, TData>(group, initialValue, updateSingleValue); | |
} | |
} else if (decoded.mayHaveNulls()) { |
TData initialValue
is LongDecimal
type which gets passed to updateNonNullValue(char* group, TInput value, Update updateValue)
where TInput
is ShortDecimal
type.
velox/type/ShortDecimal.h
Outdated
@@ -57,9 +60,21 @@ struct ShortDecimal { | |||
return unscaledValue_ >= other.unscaledValue_; | |||
} | |||
|
|||
ShortDecimal& operator+=(const ShortDecimal& other) { | |||
unscaledValue_ += other.unscaledValue_; |
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.
Do we need to check for overflow?
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.
Probably not. I think the operator type inference will ensure values fit. But doesn't hurt to add. I will add.
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.
I think the operator type inference will ensure values fit.
Would you explain how this works?
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.
We do not check for overflow for integer values right? So ShortDecimal is similar. We just treat them as any regular integers.
By operator type inference, I mean at the high level, for example, sum aggregate ensures the intermediate type is LongDecimal and the values will fit based on the precision, and scale.
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.
We didn't check for overflow in SUM, but turns out we should. Presto implementation checks, hence, we need to match. #2010 adds these checks.
velox/type/ShortDecimal.h
Outdated
private: | ||
int64_t unscaledValue_; | ||
}; | ||
|
||
static inline ShortDecimal operator*( |
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.
Why is this operator defined differently from the + operator?
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.
Apparently, only unary operators can be defined inside the class. Binary operators must be defined outside.
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.
Thank you for clarifying. Would you add a comment explaining why we need to define this operator? It is not obvious because the operator is defined only for 32-bit integers.
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.
This requirement is coming from
[](TAccumulator& result, TInput value, int n) { result += n * value; }, |
DECIMAL(23, 4))}); | ||
|
||
auto expected = makeRowVector( | ||
{makeLongDecimalFlatVector({15000}, DECIMAL(38, 1)), |
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.
nit: 15'000 for readability
{makeLongDecimalFlatVector({15000}, DECIMAL(38, 1)), | ||
makeLongDecimalFlatVector({buildInt128(50, 1500)}, DECIMAL(38, 4))}); | ||
|
||
// Global final aggregation. |
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.
Let's use testAggregations to have better test coverage.
@@ -166,6 +166,13 @@ bool registerSumAggregate(const std::string& name) { | |||
.intermediateType("double") | |||
.argumentType("double") | |||
.build(), | |||
exec::AggregateFunctionSignatureBuilder() | |||
.argumentType("DECIMAL(a_precision, a_scale)") | |||
.intermediateType("DECIMAL(38, i_scale)") |
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.
Looks like we can combine i_scale and r_scale into a single variable and use 'r_scale' in both places. This way, it will be clearer that intermediate and return types are the same.
velox/exec/GroupingSet.cpp
Outdated
// - fixed-width accumulators - one per aggregate | ||
// | ||
// Here we always make space for a row size since we only have one | ||
// row and no RowContainer. | ||
int32_t rowSizeOffset = bits::nbytes(aggregates_.size()); | ||
int32_t offset = rowSizeOffset + sizeof(int32_t); | ||
// Fixed-width accumulators must be word aligned. |
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.
Where does this requirement come from and why do we round to 16 and not 8?
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.
Without this, the LongDecimal accumulator is segfaulting as the memory address is not aligned. Hence, rounding off to 2 words, the size of LongDecimal.
The requirement comes from the implementation of
void extractAccumulators(char** groups, int32_t numGroups, VectorPtr* result)
override {
BaseAggregate::template doExtractValues<TAccumulator>(
groups, numGroups, result, [&](char* group) {
return *BaseAggregate::Aggregate::template value<TAccumulator>(group);
});
}
where
T* value(char* group) const {
return reinterpret_cast<T*>(group + offset_);
}
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.
Thank you for explaining. It appears to me that this code / requirement is highly-specific to accumulators of type LongDecimal which require 16-byte alignment. At the same time the comment sounds generic and suggests that any fixed-width accumulator must be work aligned. Here, we have only one type of accumulators requiring two word alignment. I wonder if there is a way to generalize this code. If not, let's clarify in the comment that we require 16-byte (2-word) alignment to support accumulator types that use __uint128_t.
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.
I can make this comment. But in general, I thought unaligned access is not portable across architectures. So it should apply to all types.
We can tighten this if you would like by checking all the types in the vector of accumulators and aligning by the largest type.
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.
in general, I thought unaligned access is not portable across architectures
This is so, but the comment says "word aligned", while the code makes it "two-word aligned".
We can tighten this ... by checking all the types in the vector of accumulators and aligning by the largest type.
This might be more robust and less specific to int128_t used by LongDecimal accumulator.
} else if (child->isShortDecimal() || child->isLongDecimal()) { | ||
int precision; | ||
int scale; | ||
getDecimalPrecisionScale(*child, precision, scale); |
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.
nit: Would be nice to change the signature of this function to return a pair of precision and scale.
auto [precision, scale] = getDecimalPrecisionScale(*child);
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.
The decimal add PR has this change. I will rebase after that merge or fix in that PR.
1262bbf
to
977fca5
Compare
@@ -33,6 +34,30 @@ T checkedPlus(const T& a, const T& b) { | |||
return result; | |||
} | |||
|
|||
template <> |
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.
I will move these to a separate PR and add tests.
977fca5
to
180e234
Compare
98e511a
to
ee68e05
Compare
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
ee68e05
to
2d914d0
Compare
✅ Deploy Preview for meta-velox canceled.
|
2d914d0
to
6e23d96
Compare
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.
Looks great. Thanks for effort and offline discussions. Please also have @mbasmanova to take a look before landing.
velox/vector/FlatVector.h
Outdated
@@ -107,7 +107,11 @@ class FlatVector final : public SimpleVector<T> { | |||
rawValues_(values_.get() ? const_cast<T*>(values_->as<T>()) : nullptr) { | |||
setStringBuffers(std::move(stringBuffers)); | |||
VELOX_DCHECK_GE(stringBuffers_.size(), stringBufferSet_.size()); | |||
|
|||
if constexpr (std::is_same<T, UnscaledShortDecimal>::value) { | |||
VELOX_CHECK(type->isShortDecimal()); |
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.
Consider to use DCHECK here?
VELOX_DCHECK_EQ(std::is_same_v<xxx>, type->isShortDecimal());
VELOX_DCHECK_EQ(std::is_same_v<yyy>, type->isLongDecimal());
Also please use std::is_same_v as to be consistent with other part of code (there are some ongoing efforts to refactoring this)
} | ||
|
||
/// Override 'accumulatorAlignmentSize' for UnscaledLongDecimal values as it | ||
/// uses int128_t type. |
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.
uses int128_t type. Some CPU doesn't support misaligned access to int128_t type.
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
@majetideepak Looks good to % a couple of small questions.
@@ -44,6 +44,9 @@ std::string makeCreateTableSql( | |||
} else if (child->isMap()) { | |||
sql << "MAP(" << child->asMap().keyType()->kindName() << ", " | |||
<< child->asMap().valueType()->kindName() << ")"; | |||
} else if (child->isShortDecimal() || child->isLongDecimal()) { | |||
const auto& [precision, scale] = getDecimalPrecisionScale(*child); | |||
sql << "decimal(" << precision << ", " << scale << ")"; |
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.
nit: DECIMAL for consistency
uint8_t precision; | ||
uint8_t scale; | ||
value.type().GetDecimalProperties(precision, scale); | ||
auto duckType = DECIMAL(precision, scale); |
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.
duckType -> veloxType or just 'type'
@@ -196,6 +243,12 @@ bool registerSumAggregate(const std::string& name) { | |||
.intermediateType("double") | |||
.argumentType("double") | |||
.build(), | |||
exec::AggregateFunctionSignatureBuilder() | |||
.argumentType("DECIMAL(a_precision, a_scale)") | |||
.intermediateType("DECIMAL(38, r_scale)") |
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.
Can we use "a_scale" here?
b5260d9
to
c56bde0
Compare
@mbasmanova I addressed your review comments. Thanks. |
c56bde0
to
0cf5a75
Compare
@majetideepak Thank you, Deepak. @xiaoxmeng Meng, would you help land this PR? |
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Yes, I am working on it. Thanks! |
@@ -33,6 +35,38 @@ T checkedPlus(const T& a, const T& b) { | |||
return result; | |||
} | |||
|
|||
template <> | |||
inline UnscaledShortDecimal checkedPlus( |
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.
Some template is missing:
Command failed with exit code 1.
stderr: In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
In file included from velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:19:
velox/exec/AggregationHook.h:106:14: error: no matching function for call to 'checkedPlus'
result = checkedPlus<TOutput>(result, value);
^~~~~~~~~~~~~~~~~~~~
velox/exec/AggregationHook.h:144:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::(anonymous namespace)::updateSingleValue<facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledShortDecimal>' requested here
updateSingleValue(
^
velox/exec/AggregationHook.h:112:7: note: in instantiation of member function 'facebook::velox::aggregate::SumHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal>::addValue' requested here
class SumHook final : public AggregationHook {
^
velox/functions/prestosql/aggregates/SumAggregate.h:124:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::pushdown<facebook::velox::aggregate::SumHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal>>' requested here
BaseAggregate::template pushdown<SumHook<TInput, TData>>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/common/base/CheckedArithmetic.h:29:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'const facebook::velox::UnscaledLongDecimal' for 2nd argument
T checkedPlus(const T& a, const T& b) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:102:11: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:130:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<true, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<true, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:111:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:117:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:122:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
In file included from velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:19:
velox/exec/AggregationHook.h:172:9: error: no viable conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal'
*reinterpret_cast<const TValue*>(value));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/exec/AggregationHook.h:151:7: note: in instantiation of member function 'facebook::velox::aggregate::SimpleCallableHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>::addValue' requested here
class SimpleCallableHook final : public AggregationHook {
^
velox/functions/prestosql/aggregates/SumAggregate.h:130:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<true, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<true, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/type/UnscaledLongDecimal.h:35:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'const facebook::velox::UnscaledLongDecimal &' for 1st argument
struct UnscaledLongDecimal {
^
velox/type/UnscaledLongDecimal.h:35:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal &&' for 1st argument
velox/type/UnscaledLongDecimal.h:40:22: note: explicit constructor is not a candidate
constexpr explicit UnscaledLongDecimal(int128_t value)
^
velox/type/UnscaledLongDecimal.h:43:22: note: explicit constructor is not a candidate
constexpr explicit UnscaledLongDecimal(int64_t value)
^
note: remaining 2 candidates omitted; pass -fshow-overloads=all to show them
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:102:11: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:133:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<false, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<false, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:111:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:117:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:122:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
velox/functions/prestosql/aggregates/SumAggregate.h:87:29: error: no matching member function for call to 'updateOneGroup'
BaseAggregate::template updateOneGroup<TAccumulator>(
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addSingleGroupRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:134:8: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 7th argument
void updateOneGroup(
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
velox/functions/prestosql/aggregates/SumAggregate.h:102:29: error: no matching member function for call to 'updateOneGroup'
BaseAggregate::template updateOneGroup<ResultType>(
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addSingleGroupIntermediateResults' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:134:8: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 7th argument
void updateOneGroup(
^
12 errors generated.
Cannot execute a rule out of process. On RE worker. Thread: Thread[main,5,main]
Command failed with exit code 1.
command: [/re_cwd/fbcode/buck-out/dev/gen/aab7ed39/tools/build/buck/wrappers/fbcc__/fbcc.sh, --cc=/re_cwd/fbcode/third-party-buck/platform010/build/llvm-[fb/bin/clang](https://l.workplace.com/l.php?u=https%3A%2F%2Fwww.fburl.com%2Fbin%2Fclang&h=AT0AMGrb67nKh7cGCCjxOxPtD_GISxoDBqB6bMCXiN880cpgTFp0xgOzyiWAg9WeKtKAQVAy4Pw9JmeIai_Y_mSSKrbyxsXcCigh1MiVueoF4GADSLnNVsUDLNtrtVNrE4bzBhmL32HokiBWJLYRQdf_qIUv7p7R4UPGBA)++, --target=x86_64-redhat-linux-gnu, -nostdinc, -resource-dir, /re_cwd/fbcode/third-party-buck/platform010/build/llvm-[fb/lib/clang/stable](https://l.workplace.com/l.php?u=https%3A%2F%2Fwww.fburl.com%2Flib%2Fclang%2Fstable&h=AT0AMGrb67nKh7cGCCjxOxPtD_GISxoDBqB6bMCXiN880cpgTFp0xgOzyiWAg9WeKtKAQVAy4Pw9JmeIai_Y_mSSKrbyxsXcCigh1MiVueoF4GADSLnNVsUDLNtrtVNrE4bzBhmL32HokiBWJLYRQdf_qIUv7p7R4UPGBA), -idirafter, /re_cwd/fbco...
<truncated>
...
stderr: In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
In file included from velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:19:
velox/exec/AggregationHook.h:106:14: error: no matching function for call to 'checkedPlus'
result = checkedPlus<TOutput>(result, value);
^~~~~~~~~~~~~~~~~~~~
velox/exec/AggregationHook.h:144:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::(anonymous namespace)::updateSingleValue<facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledShortDecimal>' requested here
updateSingleValue(
^
velox/exec/AggregationHook.h:112:7: note: in instantiation of member function 'facebook::velox::aggregate::SumHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal>::addValue' requested here
class SumHook final : public AggregationHook {
^
velox/functions/prestosql/aggregates/SumAggregate.h:124:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::pushdown<facebook::velox::aggregate::SumHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal>>' requested here
BaseAggregate::template pushdown<SumHook<TInput, TData>>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/common/base/CheckedArithmetic.h:29:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'const facebook::velox::UnscaledLongDecimal' for 2nd argument
T checkedPlus(const T& a, const T& b) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:102:11: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:130:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<true, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<true, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:111:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:117:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:122:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
In file included from velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:19:
velox/exec/AggregationHook.h:172:9: error: no viable conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal'
*reinterpret_cast<const TValue*>(value));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/exec/AggregationHook.h:151:7: note: in instantiation of member function 'facebook::velox::aggregate::SimpleCallableHook<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>::addValue' requested here
class SimpleCallableHook final : public AggregationHook {
^
velox/functions/prestosql/aggregates/SumAggregate.h:130:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<true, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<true, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/type/UnscaledLongDecimal.h:35:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'const facebook::velox::UnscaledLongDecimal &' for 1st argument
struct UnscaledLongDecimal {
^
velox/type/UnscaledLongDecimal.h:35:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal &&' for 1st argument
velox/type/UnscaledLongDecimal.h:40:22: note: explicit constructor is not a candidate
constexpr explicit UnscaledLongDecimal(int128_t value)
^
velox/type/UnscaledLongDecimal.h:43:22: note: explicit constructor is not a candidate
constexpr explicit UnscaledLongDecimal(int64_t value)
^
note: remaining 2 candidates omitted; pass -fshow-overloads=all to show them
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
In file included from velox/functions/prestosql/aggregates/SumAggregate.h:20:
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:102:11: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:133:31: note: in instantiation of function template specialization 'facebook::velox::aggregate::SimpleNumericAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateGroups<false, facebook::velox::UnscaledLongDecimal, void (*)(facebook::velox::UnscaledLongDecimal &, facebook::velox::UnscaledLongDecimal)>' requested here
BaseAggregate::template updateGroups<false, TData>(
^
velox/functions/prestosql/aggregates/SumAggregate.h:71:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::updateInternal<facebook::velox::UnscaledLongDecimal>' requested here
updateInternal<TAccumulator>(groups, rows, args, mayPushdown);
^
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:111:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:117:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'const facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:122:9: error: no matching member function for call to 'updateNonNullValue'
updateNonNullValue<tableHasNulls, TData>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:213:3: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 2nd argument
updateNonNullValue(char* group, TDataType value, Update updateValue) {
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
velox/functions/prestosql/aggregates/SumAggregate.h:87:29: error: no matching member function for call to 'updateOneGroup'
BaseAggregate::template updateOneGroup<TAccumulator>(
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addSingleGroupRawInput' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:134:8: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 7th argument
void updateOneGroup(
^
In file included from velox/functions/prestosql/aggregates/SumAggregate.cpp:16:
velox/functions/prestosql/aggregates/SumAggregate.h:102:29: error: no matching member function for call to 'updateOneGroup'
BaseAggregate::template updateOneGroup<ResultType>(
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
velox/functions/prestosql/aggregates/SumAggregate.h:31:12: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::addSingleGroupIntermediateResults' requested here
explicit SumAggregate(TypePtr resultType) : BaseAggregate(resultType) {}
^
third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/unique_ptr.h:962:34: note: in instantiation of member function 'facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>::SumAggregate' requested here
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
^
velox/functions/prestosql/aggregates/SumAggregate.h:290:25: note: in instantiation of function template specialization 'std::make_unique<facebook::velox::aggregate::SumAggregate<facebook::velox::UnscaledShortDecimal, facebook::velox::UnscaledLongDecimal, facebook::velox::UnscaledLongDecimal>, const std::shared_ptr<const facebook::velox::Type> &>' requested here
return std::make_unique<
^
velox/functions/prestosql/aggregates/SumAggregate.cpp:22:5: note: in instantiation of function template specialization 'facebook::velox::aggregate::registerSumAggregate<SumAggregate>' requested here
registerSumAggregate<SumAggregate>(kSum);
^
velox/functions/prestosql/aggregates/SimpleNumericAggregate.h:134:8: note: candidate function template not viable: no known conversion from 'facebook::velox::UnscaledShortDecimal' to 'facebook::velox::UnscaledLongDecimal' for 7th argument
void updateOneGroup(
^
12 errors generated.
When running <c++ preprocess_and_compile>.
When running <remote_execution>.
When building rule //velox/functions/prestosql/aggregates:aggregates#compile-pic-SumAggregate.cpp.o49bb68fa,platform010-clang (ovr_config//platform/linux:x86_64-fbcode).
TEST(DecimalTest, overloads) { | ||
ASSERT_EQ(UnscaledShortDecimal(3), UnscaledShortDecimal(10) / 3); | ||
ASSERT_EQ(UnscaledLongDecimal(33), UnscaledLongDecimal(100) / 3); | ||
ASSERT_EQ(UnscaledLongDecimal(300), UnscaledLongDecimal(100) * 3); |
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.
- operator doesn't work in fb internal tests. We can disable this and I can help on turn on this later.
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.
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.
I also want to discuss this issue further here #2388
@@ -461,5 +487,14 @@ TEST_F(SumTest, floatAggregateOverflow) { | |||
testAggregateOverflow<float, float, double>(); | |||
testAggregateOverflow<double, double>(); | |||
} | |||
|
|||
TEST_F(SumTest, decimalAggregateOverflow) { |
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.
Please skip this as it doesn't pass in fb internal test. I can help to turn on this later.
5c003ef
to
f867628
Compare
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
f867628
to
c634fed
Compare
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.
Some nits found by FB internal lint.
velox/exec/Aggregate.h
Outdated
/// Some types such as int128_t require aligned access. | ||
virtual int32_t accumulatorAlignmentSize() const { | ||
return 1; | ||
}; |
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.
Remove the trailing semicolon.
velox/type/UnscaledLongDecimal.h
Outdated
|
||
constexpr explicit UnscaledLongDecimal(int value) : unscaledValue_(value) {} | ||
|
||
UnscaledLongDecimal(UnscaledShortDecimal value) |
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.
Add explicit.
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Improve Decimal Type Function signature to re-use variables.