Process sort keys with the given schema. Note that the output vector may be larger than the input, as keys referencing a struct are recursively "expanded" into leaf fields.
| 1032 | // than the input, as keys referencing a struct are recursively "expanded" into leaf |
| 1033 | // fields. |
| 1034 | Result<std::vector<SortField>> FindSortKeys(const Schema& schema, |
| 1035 | const std::vector<SortKey>& sort_keys) { |
| 1036 | sort_fields_.reserve(sort_keys.size()); |
| 1037 | seen_.reserve(sort_keys.size()); |
| 1038 | |
| 1039 | for (const auto& sort_key : sort_keys) { |
| 1040 | ARROW_ASSIGN_OR_RAISE(auto match, |
| 1041 | PrependInvalidColumn(sort_key.target.FindOne(schema))); |
| 1042 | if (seen_.insert(match).second) { |
| 1043 | ARROW_ASSIGN_OR_RAISE(auto schema_field, match.Get(schema)); |
| 1044 | AddField(*schema_field->type(), match, sort_key.order, sort_key.null_placement); |
| 1045 | } |
| 1046 | } |
| 1047 | |
| 1048 | return std::move(sort_fields_); |
| 1049 | } |
| 1050 | |
| 1051 | protected: |
| 1052 | void AddLeafFields(const FieldVector& fields, SortOrder order, |
no test coverage detected