wgtmac commented on code in PR #143:
URL: https://github.com/apache/iceberg-cpp/pull/143#discussion_r2191959082


##########
src/iceberg/manifest_reader.h:
##########
@@ -34,19 +34,17 @@ namespace iceberg {
 /// \brief Read manifest entries from a manifest file.
 class ICEBERG_EXPORT ManifestReader {
  public:
-  virtual Result<std::span<std::unique_ptr<ManifestEntry>>> Entries() const = 
0;
+  virtual Result<std::vector<std::unique_ptr<ManifestEntry>>> Entries() const 
= 0;
 
- private:
-  std::unique_ptr<Reader> reader_;
+  static std::shared_ptr<ManifestReader> NewReader(std::unique_ptr<Reader> 
reader);

Review Comment:
   ```suggestion
     static std::unique_ptr<ManifestReader> MakeReader(std::unique_ptr<Reader> 
reader);
   ```
   
   It is a convention to use Make instead of New, Create, etc.



##########
src/iceberg/manifest_reader.h:
##########
@@ -34,19 +34,17 @@ namespace iceberg {
 /// \brief Read manifest entries from a manifest file.
 class ICEBERG_EXPORT ManifestReader {
  public:
-  virtual Result<std::span<std::unique_ptr<ManifestEntry>>> Entries() const = 
0;
+  virtual Result<std::vector<std::unique_ptr<ManifestEntry>>> Entries() const 
= 0;
 
- private:
-  std::unique_ptr<Reader> reader_;
+  static std::shared_ptr<ManifestReader> NewReader(std::unique_ptr<Reader> 
reader);

Review Comment:
   BTW, should we create the reader internally using ReaderFactory? We know the 
manifest schema and file format. Sometimes it is useful to directly return 
Arrow arrays of manifest entries. Therefore I propose the following interface 
and make them all static functions:
   
   ```cpp
   class ICEBERG_EXPORT ManifestReader {
   public:
     static Result<std::unique_ptr<Reader>> MakeReader(const std::string& 
manifest_list_location, FileIO& file_io[, std::shared_ptr<Schema> schema]);
   
     static Result<std::vector<std::unique_ptr<ManifestEntry>>> 
ReadEntries(const std::string& manifest_list_location, FileIO& file_io);
   };
   ```



##########
src/iceberg/manifest_reader.h:
##########
@@ -34,19 +34,17 @@ namespace iceberg {
 /// \brief Read manifest entries from a manifest file.
 class ICEBERG_EXPORT ManifestReader {
  public:
-  virtual Result<std::span<std::unique_ptr<ManifestEntry>>> Entries() const = 
0;
+  virtual Result<std::vector<std::unique_ptr<ManifestEntry>>> Entries() const 
= 0;
 
- private:
-  std::unique_ptr<Reader> reader_;
+  static std::shared_ptr<ManifestReader> NewReader(std::unique_ptr<Reader> 
reader);
 };
 
 /// \brief Read manifest files from a manifest list file.
 class ICEBERG_EXPORT ManifestListReader {
  public:
-  virtual Result<std::span<std::unique_ptr<ManifestFile>>> Files() const = 0;
+  virtual Result<std::vector<std::unique_ptr<ManifestFile>>> Files() const = 0;
 
- private:
-  std::unique_ptr<Reader> reader_;
+  static std::shared_ptr<ManifestListReader> NewReader(std::unique_ptr<Reader> 
reader);

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to