lxy-9602 commented on code in PR #212:
URL: https://github.com/apache/paimon-cpp/pull/212#discussion_r3811472077


##########
src/paimon/core/utils/objects_file.h:
##########
@@ -159,6 +186,7 @@ Status ObjectsFile<T>::Read(const std::string& file_name,
                            reader_builder_->Build(file_input_stream));
     auto reader = std::make_unique<ManifestMetaReader>(std::move(batch_reader),
                                                        
serializer_->GetDataType(), pool_);
+    ScopeGuard close_reader([&reader]() { reader->Close(); });

Review Comment:
   We probably don’t need `ScopeGuard` here, since cleanup is already handled 
by `ManifestMetaReader`’s destructor via `DoClose`.



##########
src/paimon/core/manifest/manifest_file.cpp:
##########
@@ -86,6 +87,24 @@ Result<std::unique_ptr<ManifestFile>> ManifestFile::Create(
                          manifest_file_factory, target_file_size, pool, 
options, partition_type));
 }
 
+Status ManifestFile::ReadBucketEntries(const std::string& file_name, int32_t 
bucket,
+                                       std::vector<ManifestEntry>* entries) 
const {
+    return ReadArrowBatches(
+        file_name,
+        [this, bucket, entries](const std::shared_ptr<arrow::StructArray>& 
batch) -> Status {
+            for (int64_t i = 0; i < batch->length(); i++) {
+                ColumnarRow row(batch->fields(), pool_, i);
+                
PAIMON_RETURN_NOT_OK(ManifestEntrySerializer::ValidateVersion(row.GetInt(0)));
+                if (row.GetInt(3) != bucket) {

Review Comment:
   Please add a `bucketGetter` in `ManifestEntrySerializer`, similar to the 
Java implementation, to avoid using the raw index 3 directly.



-- 
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]

Reply via email to