MCPcopy Create free account
hub / github.com/apache/arrow / FindSortKeys

Method FindSortKeys

cpp/src/arrow/compute/kernels/vector_sort.cc:1034–1049  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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,

Callers 1

FindSortKeysFunction · 0.80

Calls 4

reserveMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected