MCPcopy Create free account
hub / github.com/apache/arrow / Init

Method Init

cpp/src/arrow/compute/kernels/aggregate_pivot.cc:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33struct PivotImpl : public ScalarAggregator {
34 Status Init(const PivotWiderOptions& options, const std::vector<TypeHolder>& in_types,
35 ExecContext* ctx) {
36 options_ = &options;
37 key_type_ = in_types[0].GetSharedPtr();
38 auto value_type = in_types[1].GetSharedPtr();
39 FieldVector fields;
40 fields.reserve(options_->key_names.size());
41 values_.reserve(options_->key_names.size());
42 for (const auto& key_name : options_->key_names) {
43 fields.push_back(field(key_name, value_type));
44 values_.push_back(MakeNullScalar(value_type));
45 }
46 out_type_ = struct_(std::move(fields));
47 ARROW_ASSIGN_OR_RAISE(key_mapper_,
48 PivotWiderKeyMapper::Make(*key_type_, options_, ctx));
49 return Status::OK();
50 }
51
52 Status Consume(KernelContext*, const ExecSpan& batch) override {
53 DCHECK_EQ(batch.num_values(), 2);

Callers 4

PivotInitFunction · 0.45
HashAggregateInitFunction · 0.45
SortInternalMethod · 0.45
MergeInternalMethod · 0.45

Calls 9

MakeNullScalarFunction · 0.85
struct_Function · 0.85
push_backMethod · 0.80
fieldFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected