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

Function ResolveStructFieldType

cpp/src/arrow/compute/kernels/scalar_nested.cc:625–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623};
624
625Result<TypeHolder> ResolveStructFieldType(KernelContext* ctx,
626 const std::vector<TypeHolder>& types) {
627 const auto& field_ref = OptionsWrapper<StructFieldOptions>::Get(ctx).field_ref;
628 const DataType* type = types.front().type;
629
630 FieldPath field_path;
631 if (field_ref.IsNested() || field_ref.IsName()) {
632 ARROW_ASSIGN_OR_RAISE(field_path, field_ref.FindOne(*type));
633 } else {
634 field_path = *field_ref.field_path();
635 }
636
637 for (const auto& index : field_path.indices()) {
638 RETURN_NOT_OK(StructFieldFunctor::CheckIndex(index, *type));
639 type = type->field(index)->type().get();
640 }
641 return type;
642}
643
644void AddStructFieldKernels(ScalarFunction* func) {
645 for (const auto in_type : {Type::STRUCT, Type::DENSE_UNION, Type::SPARSE_UNION}) {

Callers

nothing calls this directly

Calls 7

CheckIndexFunction · 0.85
indicesMethod · 0.80
GetFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
getMethod · 0.45
typeMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected