| 45 | #define RETURN_IF_FALSE(x) if (UNLIKELY(!(x))) return parse_status_ |
| 46 | |
| 47 | Status BaseSequenceScanner::IssueInitialRanges(HdfsScanNodeBase* scan_node, |
| 48 | const vector<HdfsFileDesc*>& files) { |
| 49 | DCHECK(!files.empty()); |
| 50 | // Issue just the header range for each file. When the header is complete, |
| 51 | // we'll issue the splits for that file. Splits cannot be processed until the |
| 52 | // header is parsed (the header object is then shared across splits for that file). |
| 53 | vector<ScanRange*> header_ranges; |
| 54 | for (int i = 0; i < files.size(); ++i) { |
| 55 | ScanRangeMetadata* metadata = |
| 56 | static_cast<ScanRangeMetadata*>(files[i]->splits[0]->meta_data()); |
| 57 | int64_t header_size = min<int64_t>(HEADER_SIZE, files[i]->file_length); |
| 58 | // The header is almost always a remote read. Set the disk id to -1 and indicate |
| 59 | // it is not cached. |
| 60 | // TODO: add remote disk id and plumb that through to the io mgr. It should have |
| 61 | // 1 queue for each NIC as well? |
| 62 | bool expected_local = false; |
| 63 | int cache_options = !scan_node->IsDataCacheDisabled() ? BufferOpts::USE_DATA_CACHE : |
| 64 | BufferOpts::NO_CACHING; |
| 65 | ScanRange* header_range = scan_node->AllocateScanRange(files[i]->GetFileInfo(), |
| 66 | header_size, 0, metadata->partition_id, -1, expected_local, |
| 67 | BufferOpts(cache_options), metadata->original_split); |
| 68 | ScanRangeMetadata* header_metadata = |
| 69 | static_cast<ScanRangeMetadata*>(header_range->meta_data()); |
| 70 | header_metadata->is_sequence_header = true; |
| 71 | header_ranges.push_back(header_range); |
| 72 | } |
| 73 | // When the header is parsed, we will issue more AddDiskIoRanges in |
| 74 | // the scanner threads. |
| 75 | scan_node->UpdateRemainingScanRangeSubmissions(header_ranges.size()); |
| 76 | RETURN_IF_ERROR(scan_node->AddDiskIoRanges(header_ranges, EnqueueLocation::TAIL)); |
| 77 | return Status::OK(); |
| 78 | } |
| 79 | |
| 80 | bool BaseSequenceScanner::FileFormatIsSequenceBased(THdfsFileFormat::type format) { |
| 81 | return format == THdfsFileFormat::SEQUENCE_FILE || |
nothing calls this directly
no test coverage detected