| 291 | } |
| 292 | |
| 293 | Status HdfsColumnarScanner::DivideReservationBetweenColumns( |
| 294 | const ColumnRangeLengths& col_range_lengths, |
| 295 | ColumnReservations& reservation_per_column) { |
| 296 | io::DiskIoMgr* io_mgr = ExecEnv::GetInstance()->disk_io_mgr(); |
| 297 | const int64_t min_buffer_size = io_mgr->min_buffer_size(); |
| 298 | const int64_t max_buffer_size = io_mgr->max_buffer_size(); |
| 299 | // The HdfsScanNode reservation calculation in the planner ensures that we have |
| 300 | // reservation for at least one buffer per column. |
| 301 | if (context_->total_reservation() < min_buffer_size * col_range_lengths.size()) { |
| 302 | return Status(TErrorCode::INTERNAL_ERROR, |
| 303 | Substitute("Not enough reservation in columnar scanner for file '$0'. " |
| 304 | "Need at least $1 bytes per column for $2 columns but had $3 bytes", |
| 305 | filename(), min_buffer_size, col_range_lengths.size(), |
| 306 | context_->total_reservation())); |
| 307 | } |
| 308 | |
| 309 | // The scanner-wide stream was used only to read the file footer. Each column has added |
| 310 | // its own stream. We can use the total reservation now that 'stream_''s resources have |
| 311 | // been released. We may benefit from increasing reservation further, so let's compute |
| 312 | // the ideal reservation to scan all the columns. |
| 313 | int64_t ideal_reservation = ComputeIdealReservation(col_range_lengths); |
| 314 | if (ideal_reservation > context_->total_reservation()) { |
| 315 | context_->TryIncreaseReservation(ideal_reservation); |
| 316 | } |
| 317 | columnar_scanner_actual_reservation_counter_->UpdateCounter( |
| 318 | context_->total_reservation()); |
| 319 | columnar_scanner_ideal_reservation_counter_->UpdateCounter(ideal_reservation); |
| 320 | |
| 321 | reservation_per_column = DivideReservationBetweenColumnsHelper( |
| 322 | min_buffer_size, max_buffer_size, col_range_lengths, context_->total_reservation()); |
| 323 | return Status::OK(); |
| 324 | } |
| 325 | |
| 326 | void HdfsColumnarScanner::AddSyncReadBytesCounter(int64_t total_bytes) { |
| 327 | io_sync_request_->Add(1); |
nothing calls this directly
no test coverage detected