| 513 | } |
| 514 | |
| 515 | Status HdfsTextScanner::FillByteBuffer(MemPool* pool, bool* eosr, int num_bytes) { |
| 516 | *eosr = false; |
| 517 | |
| 518 | if (decompressor_.get() == nullptr) { |
| 519 | Status status; |
| 520 | if (num_bytes > 0) { |
| 521 | if (!stream_->GetBytes(num_bytes, |
| 522 | reinterpret_cast<uint8_t**>(&byte_buffer_ptr_), &byte_buffer_read_size_, |
| 523 | &status)) { |
| 524 | DCHECK(!status.ok()); |
| 525 | return status; |
| 526 | } |
| 527 | } else { |
| 528 | DCHECK_EQ(num_bytes, 0); |
| 529 | RETURN_IF_ERROR(stream_->GetBuffer(false, |
| 530 | reinterpret_cast<uint8_t**>(&byte_buffer_ptr_), &byte_buffer_read_size_)); |
| 531 | } |
| 532 | *eosr = stream_->eosr(); |
| 533 | } else if (decompressor_->supports_streaming()) { |
| 534 | DCHECK_EQ(num_bytes, 0); |
| 535 | RETURN_IF_ERROR(DecompressStreamToBuffer( |
| 536 | reinterpret_cast<uint8_t**>(&byte_buffer_ptr_), &byte_buffer_read_size_, |
| 537 | pool, eosr)); |
| 538 | } else { |
| 539 | DCHECK_EQ(num_bytes, 0); |
| 540 | RETURN_IF_ERROR(DecompressFileToBuffer(reinterpret_cast<uint8_t**>(&byte_buffer_ptr_), |
| 541 | &byte_buffer_read_size_)); |
| 542 | *eosr = byte_buffer_read_size_ == 0 ? true : stream_->eosr(); |
| 543 | } |
| 544 | |
| 545 | if (decoder_.get() != nullptr) { |
| 546 | SCOPED_TIMER(decode_timer_); |
| 547 | RETURN_IF_ERROR(decoder_->DecodeBuffer(reinterpret_cast<uint8_t**>(&byte_buffer_ptr_), |
| 548 | &byte_buffer_read_size_, pool, *eosr, decompressor_.get() != nullptr, context_)); |
| 549 | } |
| 550 | |
| 551 | byte_buffer_end_ = byte_buffer_ptr_ + byte_buffer_read_size_; |
| 552 | return Status::OK(); |
| 553 | } |
| 554 | |
| 555 | Status HdfsTextScanner::FindFirstTuple(MemPool* pool) { |
| 556 | DCHECK_EQ(scan_state_, SCAN_RANGE_INITIALIZED); |
nothing calls this directly
no test coverage detected