|
28 | 28 | namespace iceberg { |
29 | 29 |
|
30 | 30 | Result<std::unique_ptr<ManifestReader>> ManifestReader::MakeReader( |
31 | | - const std::string& manifest_location, std::shared_ptr<FileIO> file_io, |
| 31 | + std::string_view manifest_location, std::shared_ptr<FileIO> file_io, |
32 | 32 | std::shared_ptr<Schema> partition_schema) { |
33 | 33 | auto manifest_entry_schema = ManifestEntry::TypeFromPartitionType(partition_schema); |
34 | 34 | auto fields_span = manifest_entry_schema->fields(); |
35 | 35 | std::vector<SchemaField> fields(fields_span.begin(), fields_span.end()); |
36 | 36 | auto schema = std::make_shared<Schema>(fields); |
37 | 37 | ICEBERG_ASSIGN_OR_RAISE( |
38 | | - auto reader, |
39 | | - ReaderFactoryRegistry::Open( |
40 | | - FileFormatType::kAvro, |
41 | | - {.path = manifest_location, .io = std::move(file_io), .projection = schema})); |
| 38 | + auto reader, ReaderFactoryRegistry::Open(FileFormatType::kAvro, |
| 39 | + {.path = std::string(manifest_location), |
| 40 | + .io = std::move(file_io), |
| 41 | + .projection = schema})); |
42 | 42 | return std::make_unique<ManifestReaderImpl>(std::move(reader), std::move(schema)); |
43 | 43 | } |
44 | 44 |
|
45 | 45 | Result<std::unique_ptr<ManifestListReader>> ManifestListReader::MakeReader( |
46 | | - const std::string& manifest_list_location, std::shared_ptr<FileIO> file_io) { |
| 46 | + std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io) { |
47 | 47 | std::vector<SchemaField> fields(ManifestFile::Type().fields().begin(), |
48 | 48 | ManifestFile::Type().fields().end()); |
49 | 49 | auto schema = std::make_shared<Schema>(fields); |
50 | | - ICEBERG_ASSIGN_OR_RAISE( |
51 | | - auto reader, |
52 | | - ReaderFactoryRegistry::Open(FileFormatType::kAvro, {.path = manifest_list_location, |
53 | | - .io = std::move(file_io), |
54 | | - .projection = schema})); |
| 50 | + ICEBERG_ASSIGN_OR_RAISE(auto reader, ReaderFactoryRegistry::Open( |
| 51 | + FileFormatType::kAvro, |
| 52 | + {.path = std::string(manifest_list_location), |
| 53 | + .io = std::move(file_io), |
| 54 | + .projection = schema})); |
55 | 55 | return std::make_unique<ManifestListReaderImpl>(std::move(reader), std::move(schema)); |
56 | 56 | } |
57 | 57 |
|
58 | | -Result<std::unique_ptr<ManifestListReader>> CreateManifestListReader( |
59 | | - std::string_view file_path) { |
60 | | - return NotImplemented("CreateManifestListReader is not implemented yet."); |
61 | | -} |
62 | | - |
63 | | -Result<std::unique_ptr<ManifestReader>> CreateManifestReader(std::string_view file_path) { |
64 | | - return NotImplemented("CreateManifestReader is not implemented yet."); |
65 | | -} |
66 | | - |
67 | 58 | } // namespace iceberg |
0 commit comments