Github user hbdeshmukh commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/90#discussion_r78233635 --- Diff: expressions/aggregation/AggregationHandleAvg.hpp --- @@ -109,8 +129,41 @@ class AggregationHandleAvg : public AggregationConcreteHandle { ++state->count_; } + inline void iterateUnaryInlFast(const TypedValue &value, + std::uint8_t *byte_ptr) const { + DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature())); + if (value.isNull()) return; + TypedValue *sum_ptr = + reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_); + std::int64_t *count_ptr = + reinterpret_cast<std::int64_t *>(byte_ptr + blank_state_.count_offset_); + *sum_ptr = fast_add_operator_->applyToTypedValues(*sum_ptr, value); + ++(*count_ptr); + } + + inline void updateState(const std::vector<TypedValue> &arguments, --- End diff -- We only need one argument here, instead of a vector. As a further optimization, we can use an Untyped value (i.e. a pointer) instead of a TypedValue. As the fast_add_operator_ in this class is already an UncheckedOperator, it can work with untyped values.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---