| 404 | } |
| 405 | |
| 406 | void Plan::BuildScanRangeSpec(const TableName& table_name, |
| 407 | const FileSplitGeneratorSpec& spec, int spec_idx, BlockNamingPolicy naming_policy, |
| 408 | TFileSplitGeneratorSpec* thrift_spec) { |
| 409 | THdfsFileDesc thrift_file; |
| 410 | |
| 411 | string relative_path; |
| 412 | int64_t partition_id; |
| 413 | string partition_path; |
| 414 | GetBlockPaths(table_name, true, spec_idx, naming_policy, &relative_path, |
| 415 | &partition_id, &partition_path); |
| 416 | |
| 417 | flatbuffers::FlatBufferBuilder fb_builder; |
| 418 | auto rel_path = |
| 419 | fb_builder.CreateString(relative_path); |
| 420 | auto fb_file_desc = CreateFbFileDesc(fb_builder, rel_path, spec.length); |
| 421 | fb_builder.Finish(fb_file_desc); |
| 422 | |
| 423 | string buffer( |
| 424 | reinterpret_cast<const char*>(fb_builder.GetBufferPointer()), fb_builder.GetSize()); |
| 425 | thrift_file.__set_file_desc_data(buffer); |
| 426 | |
| 427 | thrift_spec->__set_partition_id(partition_id); |
| 428 | thrift_spec->__set_file_desc(thrift_file); |
| 429 | thrift_spec->__set_max_block_size(spec.block_size); |
| 430 | thrift_spec->__set_is_splittable(spec.is_splittable); |
| 431 | thrift_spec->__set_is_footer_only(spec.is_footer_only); |
| 432 | int32_t partition_path_hash = static_cast<int32_t>(HashUtil::Hash(partition_path.data(), |
| 433 | partition_path.length(), 0)); |
| 434 | thrift_spec->__set_partition_path_hash(partition_path_hash); |
| 435 | } |
| 436 | |
| 437 | int Plan::FindOrInsertDatanodeIndex(int cluster_datanode_idx) { |
| 438 | const Host& host = schema_.cluster().hosts()[cluster_datanode_idx]; |