| 719 | } |
| 720 | |
| 721 | Result<std::shared_ptr<Scalar>> StructScalar::field(FieldRef ref) const { |
| 722 | ARROW_ASSIGN_OR_RAISE(auto path, ref.FindOne(*type)); |
| 723 | if (path.indices().size() != 1) { |
| 724 | return Status::NotImplemented("retrieval of nested fields from StructScalar"); |
| 725 | } |
| 726 | auto index = path.indices()[0]; |
| 727 | if (is_valid) { |
| 728 | return value[index]; |
| 729 | } else { |
| 730 | const auto& struct_type = checked_cast<const StructType&>(*this->type); |
| 731 | const auto& field_type = struct_type.field(index)->type(); |
| 732 | return MakeNullScalar(field_type); |
| 733 | } |
| 734 | } |
| 735 | |
| 736 | RunEndEncodedScalar::RunEndEncodedScalar(std::shared_ptr<Scalar> value, |
| 737 | std::shared_ptr<DataType> type) |