MCPcopy Create free account
hub / github.com/bytedance/bolt / reduce

Method reduce

bolt/cudf/exec/HashAggregation.cpp:178–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176 }
177
178 std::vector<std::unique_ptr<::cudf::column>> reduce(
179 const ::cudf::column_view& values) override {
180 std::vector<std::unique_ptr<::cudf::column>> result;
181 if (isStepWithRawInput()) {
182 try {
183 auto sumScalar = ::cudf::reduce(
184 values,
185 *::cudf::make_sum_aggregation<::cudf::reduce_aggregation>(),
186 values.type(),
187 stream_);
188 result.emplace_back(
189 ::cudf::make_column_from_scalar(*sumScalar, 1, stream_));
190 } catch (const ::cudf::logic_error& e) {
191 BOLT_FAIL("Avg aggregation failed: {}", e.what());
192 }
193 auto countScalar = std::make_unique<::cudf::numeric_scalar<int64_t>>(
194 values.size() - values.null_count(), true, stream_);
195 result.emplace_back(
196 ::cudf::make_column_from_scalar(*countScalar, 1, stream_));
197 } else {
198 try {
199 auto sumScalar = ::cudf::reduce(
200 values,
201 *::cudf::make_sum_aggregation<::cudf::reduce_aggregation>(),
202 values.type(),
203 stream_);
204 result.emplace_back(
205 ::cudf::make_column_from_scalar(*sumScalar, 1, stream_));
206 } catch (const ::cudf::logic_error& e) {
207 BOLT_FAIL("Avg aggregation failed: {}", e.what());
208 }
209 }
210 return result;
211 }
212
213 std::vector<std::unique_ptr<::cudf::column>> finalize(
214 std::vector<std::unique_ptr<::cudf::column>>&& intermediateCols)

Callers 1

reduceRecursiveFunction · 0.45

Calls 5

reduceFunction · 0.85
null_countMethod · 0.80
typeMethod · 0.45
whatMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected