leaves12138 commented on code in PR #31:
URL: https://github.com/apache/paimon-cpp/pull/31#discussion_r3322010598


##########
src/paimon/common/data/blob.cpp:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "paimon/data/blob.h"
+
+#include <memory>
+#include <utility>
+
+#include "arrow/c/bridge.h"
+#include "paimon/common/data/blob_descriptor.h"
+#include "paimon/common/data/blob_utils.h"
+#include "paimon/common/io/offset_input_stream.h"
+#include "paimon/common/utils/arrow/status_utils.h"
+#include "paimon/common/utils/path_util.h"
+#include "paimon/common/utils/stream_utils.h"
+#include "paimon/memory/bytes.h"
+#include "paimon/status.h"
+
+namespace paimon {
+
+class MemoryPool;
+
+class Blob::Impl {
+ public:
+    Impl(std::unique_ptr<BlobDescriptor>&& descriptor, const std::string& uri)
+        : descriptor_(std::move(descriptor)), uri_(uri) {}
+
+    PAIMON_UNIQUE_PTR<Bytes> SerializeDescriptor(const 
std::shared_ptr<MemoryPool>& pool) const {
+        return descriptor_->Serialize(pool);
+    }
+
+    const BlobDescriptor* GetDescriptor() const {
+        return descriptor_.get();
+    }
+
+    const std::string& Uri() const {
+        return uri_;
+    }
+
+ private:
+    std::unique_ptr<BlobDescriptor> descriptor_;
+    std::string uri_;
+};
+
+Result<std::unique_ptr<Blob>> Blob::FromPath(const std::string& path) {
+    return FromPath(path, /*offset=*/0, /*length=*/-1);
+}
+
+Result<std::unique_ptr<Blob>> Blob::FromPath(const std::string& path, int64_t 
offset,
+                                             int64_t length) {
+    PAIMON_ASSIGN_OR_RAISE(std::string normalized_path, 
PathUtil::NormalizePath(path));
+    PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<BlobDescriptor> descriptor,
+                           BlobDescriptor::Create(normalized_path, offset, 
length));
+    auto impl = std::make_unique<Blob::Impl>(std::move(descriptor), 
descriptor->Uri());

Review Comment:
   This passes  and  in the same function call. The argument evaluation order 
is unspecified, so  may run after the unique_ptr has been moved from and become 
null. Please capture the URI before moving ; the same pattern below in  needs 
the same fix.



##########
src/paimon/common/data/serializer/row_compacted_serializer.h:
##########
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+#include <functional>
+
+#include "arrow/api.h"
+#include "paimon/common/data/binary_row.h"
+#include "paimon/common/data/binary_writer.h"
+#include "paimon/common/memory/memory_segment.h"
+#include "paimon/common/memory/memory_segment_utils.h"
+#include "paimon/common/memory/memory_slice.h"
+#include "paimon/common/utils/var_length_int_utils.h"

Review Comment:
   This header is not present in the PR head or the current base branch, so 
including  makes this code fail to compile. Please add the missing utility 
header/implementation or switch to an existing varint helper.



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