MCPcopy Create free account
hub / github.com/apache/impala / StartNextScanRange

Method StartNextScanRange

be/src/exec/hdfs-scan-node-base.cc:814–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814Status HdfsScanNodeBase::StartNextScanRange(const std::vector<FilterContext>& filter_ctxs,
815 int64_t* reservation, ScanRange** scan_range) {
816 DiskIoMgr* io_mgr = ExecEnv::GetInstance()->disk_io_mgr();
817 bool needs_buffers;
818 // Loop until we've got a scan range or run out of ranges.
819 do {
820 RETURN_IF_ERROR(GetNextScanRangeToRead(scan_range, &needs_buffers));
821 if (*scan_range == nullptr) return Status::OK();
822 if (filter_ctxs.size() > 0) {
823 int64_t partition_id =
824 static_cast<ScanRangeMetadata*>((*scan_range)->meta_data())->partition_id;
825 if (!hdfs_table()->IsIcebergTable() &&
826 !PartitionPassesFilters(partition_id, FilterStats::SPLITS_KEY, filter_ctxs)) {
827 SkipScanRange(*scan_range);
828 *scan_range = nullptr;
829 }
830 }
831 } while (*scan_range == nullptr);
832 if (needs_buffers) {
833 // Check if we should increase our reservation to read this range more efficiently.
834 // E.g. if we are scanning a large text file, we might want extra I/O buffers to
835 // improve throughput. Note that if this is a columnar format like Parquet,
836 // '*scan_range' is the small footer range only so we won't request an increase.
837 int64_t ideal_scan_range_reservation =
838 io_mgr->ComputeIdealBufferReservation((*scan_range)->bytes_to_read());
839 *reservation = IncreaseReservationIncrementally(*reservation, ideal_scan_range_reservation);
840 initial_range_ideal_reservation_stats_->UpdateCounter(ideal_scan_range_reservation);
841 initial_range_actual_reservation_stats_->UpdateCounter(*reservation);
842 RETURN_IF_ERROR(
843 io_mgr->AllocateBuffersForRange(buffer_pool_client(), *scan_range, *reservation));
844 }
845 return Status::OK();
846}
847
848int64_t HdfsScanNodeBase::IncreaseReservationIncrementally(int64_t curr_reservation,
849 int64_t ideal_reservation) {

Callers

nothing calls this directly

Calls 9

OKFunction · 0.85
disk_io_mgrMethod · 0.80
meta_dataMethod · 0.80
IsIcebergTableMethod · 0.80
bytes_to_readMethod · 0.80
sizeMethod · 0.45
UpdateCounterMethod · 0.45

Tested by

no test coverage detected