| 207 | } |
| 208 | |
| 209 | Result<std::shared_ptr<Schema>> MakeOutputSchema( |
| 210 | const std::shared_ptr<Schema>& input_schema, const std::vector<FieldRef>& keys, |
| 211 | const std::vector<FieldRef>& segment_keys, const std::vector<Aggregate>& aggregates, |
| 212 | ExecContext* exec_ctx) { |
| 213 | if (keys.empty()) { |
| 214 | ARROW_ASSIGN_OR_RAISE(auto args, |
| 215 | ScalarAggregateNode::MakeAggregateNodeArgs( |
| 216 | input_schema, keys, segment_keys, aggregates, exec_ctx, |
| 217 | /*concurrency=*/1, /*is_cpu_parallel=*/false)); |
| 218 | return std::move(args.output_schema); |
| 219 | } else { |
| 220 | ARROW_ASSIGN_OR_RAISE(auto args, GroupByNode::MakeAggregateNodeArgs( |
| 221 | input_schema, keys, segment_keys, aggregates, |
| 222 | exec_ctx, /*is_cpu_parallel=*/false)); |
| 223 | return std::move(args.output_schema); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | Result<std::vector<Datum>> ExtractValues(const ExecBatch& input_batch, |
| 228 | const std::vector<int>& field_ids) { |