| 727 | } |
| 728 | |
| 729 | void ArrayVectorBase::validateArrayVectorBase( |
| 730 | const VectorValidateOptions& options, |
| 731 | vector_size_t minChildVectorSize) const { |
| 732 | BaseVector::validate(options); |
| 733 | auto bufferByteSize = byteSize<vector_size_t>(BaseVector::length_); |
| 734 | BOLT_CHECK_GE(sizes_->size(), bufferByteSize); |
| 735 | BOLT_CHECK_GE(offsets_->size(), bufferByteSize); |
| 736 | for (auto i = 0; i < BaseVector::length_; ++i) { |
| 737 | const bool isNull = |
| 738 | BaseVector::rawNulls_ && bits::isBitNull(BaseVector::rawNulls_, i); |
| 739 | if (isNull || rawSizes_[i] == 0) { |
| 740 | continue; |
| 741 | } |
| 742 | // Verify index for a non-null position. It must be >= 0 and < size of the |
| 743 | // base vector. |
| 744 | BOLT_CHECK_GE( |
| 745 | rawSizes_[i], |
| 746 | 0, |
| 747 | "ArrayVectorBase size must be greater than zero. Index: {}.", |
| 748 | i); |
| 749 | BOLT_CHECK_GE( |
| 750 | rawOffsets_[i], |
| 751 | 0, |
| 752 | "ArrayVectorBase offset must be greater than zero. Index: {}.", |
| 753 | i) |
| 754 | BOLT_CHECK_LT( |
| 755 | rawOffsets_[i] + rawSizes_[i] - 1, |
| 756 | minChildVectorSize, |
| 757 | "ArrayVectorBase must only point to indices within the base " |
| 758 | "vector's size. Index: {}.", |
| 759 | i); |
| 760 | } |
| 761 | } |
| 762 | |
| 763 | namespace { |
| 764 | |