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

Function MaybeConvertFieldRef

cpp/src/arrow/dataset/file_parquet.cc:267–285  ·  view source on GitHub ↗

Converts a field ref into a position-independent ref (containing only a sequence of names) based on the dataset schema. Returns `false` if no conversion was needed.

Source from the content-addressed store, hash-verified

265// Converts a field ref into a position-independent ref (containing only a sequence of
266// names) based on the dataset schema. Returns `false` if no conversion was needed.
267Result<FieldRef> MaybeConvertFieldRef(FieldRef ref, const Schema& dataset_schema) {
268 if (ARROW_PREDICT_TRUE(ref.IsNameSequence())) {
269 return ref;
270 }
271
272 ARROW_ASSIGN_OR_RAISE(auto path, ref.FindOne(dataset_schema));
273 std::vector<FieldRef> named_refs;
274 named_refs.reserve(path.indices().size());
275
276 const FieldVector* child_fields = &dataset_schema.fields();
277 for (auto index : path) {
278 const auto& child_field = *(*child_fields)[index];
279 named_refs.emplace_back(child_field.name());
280 child_fields = &child_field.type()->fields();
281 }
282
283 return named_refs.size() == 1 ? std::move(named_refs[0])
284 : FieldRef(std::move(named_refs));
285}
286
287// Compute the column projection based on the scan options
288Result<std::vector<int>> InferColumnProjection(const parquet::arrow::FileReader& reader,

Callers 1

InferColumnProjectionFunction · 0.85

Calls 8

indicesMethod · 0.80
emplace_backMethod · 0.80
FieldRefFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
fieldsMethod · 0.45
nameMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected