| 55 | } |
| 56 | |
| 57 | inline std::shared_ptr<Schema> SchemaFromColumnNames( |
| 58 | const std::shared_ptr<Schema>& input, const std::vector<std::string>& column_names) { |
| 59 | std::vector<std::shared_ptr<Field>> columns; |
| 60 | for (FieldRef ref : column_names) { |
| 61 | auto maybe_field = ref.GetOne(*input); |
| 62 | if (maybe_field.ok()) { |
| 63 | columns.push_back(std::move(maybe_field).ValueOrDie()); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return schema(std::move(columns))->WithMetadata(input->metadata()); |
| 68 | } |
| 69 | |
| 70 | /// Get fragment scan options of the expected type. |
| 71 | /// \return Fragment scan options if provided on the scan options, else the default |