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

Method AddScanRanges

be/src/runtime/io/request-context.cc:420–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420Status RequestContext::AddScanRanges(
421 const vector<ScanRange*>& ranges, EnqueueLocation enqueue_location) {
422 DCHECK_GT(ranges.size(), 0);
423 // Validate and initialize all ranges
424 for (int i = 0; i < ranges.size(); ++i) {
425 RETURN_IF_ERROR(parent_->ValidateScanRange(ranges[i]));
426 ranges[i]->InitInternal(parent_, this);
427 }
428
429 unique_lock<mutex> lock(lock_);
430 DCHECK(Validate()) << endl << DebugString();
431
432 if (state_ == RequestContext::Cancelled) return CONTEXT_CANCELLED;
433
434 // Add each range to the queue of the disk the range is on
435 for (ScanRange* range : ranges) {
436 // Don't add empty ranges.
437 DCHECK_NE(range->bytes_to_read(), 0);
438 AddActiveScanRangeLocked(lock, range);
439 if (range->UseHdfsCache()) {
440 cached_ranges_.Enqueue(range);
441 } else {
442 AddRangeToDisk(lock, range, (enqueue_location == EnqueueLocation::HEAD) ?
443 ScheduleMode::UPON_GETNEXT_HEAD :
444 ScheduleMode::UPON_GETNEXT_TAIL);
445 }
446 }
447 DCHECK(Validate()) << endl << DebugString();
448 return Status::OK();
449}
450
451// This function returns the next scan range the reader should work on, checking
452// for eos and error cases. If there isn't already a cached scan range or a scan

Callers 4

SingleReaderTestBodyMethod · 0.45
TEST_FFunction · 0.45
CachedReadsTestBodyMethod · 0.45
NewClientMethod · 0.45

Calls 9

OKFunction · 0.85
bytes_to_readMethod · 0.80
UseHdfsCacheMethod · 0.80
ValidateFunction · 0.50
DebugStringFunction · 0.50
sizeMethod · 0.45
ValidateScanRangeMethod · 0.45
InitInternalMethod · 0.45
EnqueueMethod · 0.45

Tested by 3

SingleReaderTestBodyMethod · 0.36
TEST_FFunction · 0.36
CachedReadsTestBodyMethod · 0.36