| 429 | // the string buffers. |
| 430 | template <> |
| 431 | void FlatVector<StringView>::validate( |
| 432 | const VectorValidateOptions& options) const { |
| 433 | SimpleVector<StringView>::validate(options); |
| 434 | auto byteSize = BaseVector::byteSize<StringView>(BaseVector::size()); |
| 435 | if (byteSize == 0) { |
| 436 | return; |
| 437 | } |
| 438 | BOLT_CHECK_NOT_NULL(values_); |
| 439 | BOLT_CHECK_GE(values_->size(), byteSize); |
| 440 | auto rawValues = values_->as<StringView>(); |
| 441 | |
| 442 | for (auto i = 0; i < BaseVector::length_; ++i) { |
| 443 | if (isNullAt(i)) { |
| 444 | continue; |
| 445 | } |
| 446 | auto stringView = rawValues[i]; |
| 447 | if (!stringView.isInline()) { |
| 448 | bool isValid = false; |
| 449 | for (const auto& buffer : stringBuffers_) { |
| 450 | auto start = buffer->as<char>(); |
| 451 | if (stringView.data() >= start && |
| 452 | stringView.data() < start + buffer->size()) { |
| 453 | isValid = true; |
| 454 | break; |
| 455 | } |
| 456 | } |
| 457 | BOLT_CHECK( |
| 458 | isValid, |
| 459 | "String view at idx {} points outside of the string buffers", |
| 460 | i) |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | template <> |
| 466 | uint64_t FlatVector<StringView>::estimateExportArrowSize() const { |