| 379 | } |
| 380 | |
| 381 | void Plan::BuildScanRange(const TableName& table_name, const Block& block, int block_idx, |
| 382 | BlockNamingPolicy naming_policy, TScanRange* scan_range) { |
| 383 | // Initialize locations.scan_range correctly. |
| 384 | THdfsFileSplit file_split; |
| 385 | // 'length' is the only member considered by the scheduler for scheduling non-remote |
| 386 | // blocks. |
| 387 | file_split.length = block.length; |
| 388 | |
| 389 | // Consistent remote scheduling considers the partition_path_hash, relative_path, |
| 390 | // and offset when scheduling blocks. |
| 391 | string partition_path; |
| 392 | GetBlockPaths(table_name, false, block_idx, naming_policy, &file_split.relative_path, |
| 393 | &file_split.partition_id, &partition_path); |
| 394 | file_split.partition_path_hash = |
| 395 | static_cast<int32_t>(HashUtil::Hash(partition_path.data(), |
| 396 | partition_path.length(), 0)); |
| 397 | file_split.offset = 0; |
| 398 | |
| 399 | // For now, we model each file by a single block. |
| 400 | file_split.file_length = block.length; |
| 401 | file_split.file_compression = THdfsCompression::NONE; |
| 402 | file_split.mtime = 1; |
| 403 | scan_range->__set_hdfs_file_split(file_split); |
| 404 | } |
| 405 | |
| 406 | void Plan::BuildScanRangeSpec(const TableName& table_name, |
| 407 | const FileSplitGeneratorSpec& spec, int spec_idx, BlockNamingPolicy naming_policy, |