| 454 | } |
| 455 | |
| 456 | Status ValidateDenseUnion(const DenseUnionScalar& s, int child_id) { |
| 457 | const auto& union_type = checked_cast<const DenseUnionType&>(*s.type); |
| 458 | const auto& field_type = *union_type.field(child_id)->type(); |
| 459 | if (!field_type.Equals(*s.value->type)) { |
| 460 | return Status::Invalid(s.type->ToString(), " scalar with type code ", s.type_code, |
| 461 | " should have an underlying value of type ", |
| 462 | field_type.ToString(), ", got ", s.value->type->ToString()); |
| 463 | } |
| 464 | return ValidateValue(s, *s.value); |
| 465 | } |
| 466 | |
| 467 | Status ValidateSparseUnion(const SparseUnionScalar& s) { |
| 468 | const auto& union_type = checked_cast<const SparseUnionType&>(*s.type); |