| 178 | } |
| 179 | |
| 180 | Result<ExecNode*> GroupByNode::Make(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 181 | const ExecNodeOptions& options) { |
| 182 | RETURN_NOT_OK(ValidateExecNodeInputs(plan, inputs, 1, "GroupByNode")); |
| 183 | |
| 184 | auto input = inputs[0]; |
| 185 | const auto& aggregate_options = checked_cast<const AggregateNodeOptions&>(options); |
| 186 | const auto& keys = aggregate_options.keys; |
| 187 | const auto& segment_keys = aggregate_options.segment_keys; |
| 188 | auto aggs = aggregate_options.aggregates; |
| 189 | bool is_cpu_parallel = plan->query_context()->executor()->GetCapacity() > 1; |
| 190 | |
| 191 | const auto& input_schema = input->output_schema(); |
| 192 | auto exec_ctx = plan->query_context()->exec_context(); |
| 193 | ARROW_ASSIGN_OR_RAISE( |
| 194 | auto args, MakeAggregateNodeArgs(input_schema, keys, segment_keys, aggs, exec_ctx, |
| 195 | is_cpu_parallel)); |
| 196 | |
| 197 | return input->plan()->EmplaceNode<GroupByNode>( |
| 198 | input, std::move(args.output_schema), std::move(args.grouping_key_field_ids), |
| 199 | std::move(args.segment_key_field_ids), std::move(args.segmenter), |
| 200 | std::move(args.kernel_intypes), std::move(args.target_fieldsets), |
| 201 | std::move(args.aggregates), std::move(args.kernels)); |
| 202 | } |
| 203 | |
| 204 | Status GroupByNode::ResetKernelStates() { |
| 205 | auto ctx = plan()->query_context()->exec_context(); |
nothing calls this directly
no test coverage detected