| 170 | namespace { |
| 171 | |
| 172 | Result<DeclarationInfo> ProcessExtensionEmit(const DeclarationInfo& no_emit_declr, |
| 173 | const std::vector<int>& emit_order) { |
| 174 | const std::shared_ptr<Schema>& input_schema = no_emit_declr.output_schema; |
| 175 | std::vector<compute::Expression> proj_field_refs; |
| 176 | proj_field_refs.reserve(emit_order.size()); |
| 177 | FieldVector emit_fields; |
| 178 | emit_fields.reserve(emit_order.size()); |
| 179 | |
| 180 | for (int emit_idx : emit_order) { |
| 181 | if (emit_idx < 0 || emit_idx >= input_schema->num_fields()) { |
| 182 | return Status::Invalid("Out of bounds emit index ", emit_idx); |
| 183 | } |
| 184 | proj_field_refs.push_back(compute::field_ref(FieldRef(emit_idx))); |
| 185 | emit_fields.push_back(input_schema->field(emit_idx)); |
| 186 | } |
| 187 | |
| 188 | std::shared_ptr<Schema> emit_schema = schema(std::move(emit_fields)); |
| 189 | |
| 190 | return DeclarationInfo{ |
| 191 | acero::Declaration::Sequence( |
| 192 | {no_emit_declr.declaration, |
| 193 | {"project", acero::ProjectNodeOptions{std::move(proj_field_refs)}}}), |
| 194 | std::move(emit_schema)}; |
| 195 | } |
| 196 | |
| 197 | Result<DeclarationInfo> GetExtensionInfo(const substrait::Rel& rel, |
| 198 | const ExtensionSet& ext_set, |