| 79 | int64_t EstimatedDataBytes(int) override { return block_size_; } |
| 80 | |
| 81 | static Result<std::shared_ptr<Schema>> GetSchema( |
| 82 | const FragmentScanRequest& scan_request, const JsonInspectedFragment& inspected) { |
| 83 | FieldVector fields; |
| 84 | fields.reserve(inspected.column_names.size()); |
| 85 | std::unordered_set<int> indices; |
| 86 | indices.reserve(inspected.column_names.size()); |
| 87 | |
| 88 | for (const auto& scan_column : scan_request.fragment_selection->columns()) { |
| 89 | const auto index = scan_column.path[0]; |
| 90 | |
| 91 | if (!indices.emplace(index).second) continue; |
| 92 | |
| 93 | const auto& name = inspected.column_names.at(index); |
| 94 | auto type = scan_column.requested_type->GetSharedPtr(); |
| 95 | fields.push_back(field((name), std::move(type))); |
| 96 | } |
| 97 | |
| 98 | return schema(std::move(fields)); |
| 99 | } |
| 100 | |
| 101 | static Future<std::shared_ptr<FragmentScanner>> Make( |
| 102 | const FragmentScanRequest& scan_request, |