Copilot commented on code in PR #777:
URL: https://github.com/apache/iceberg-cpp/pull/777#discussion_r3465640982


##########
src/iceberg/data/deletion_vector_writer.cc:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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 "iceberg/data/deletion_vector_writer.h"
+
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>

Review Comment:
   This TU uses `std::make_optional` / `std::nullopt` but does not include 
`<optional>` directly, relying on transitive includes (currently via other 
headers). Adding `<optional>` here makes the dependency explicit and prevents 
fragile builds if headers change.



##########
src/iceberg/puffin/puffin_writer.cc:
##########
@@ -46,6 +48,11 @@ Result<std::unique_ptr<PuffinWriter>> PuffinWriter::Make(
     PuffinCompressionCodec default_codec, bool compress_footer) {
   ICEBERG_PRECHECK(output_file, "Output file must not be null");
   ICEBERG_ASSIGN_OR_RAISE(auto stream, output_file->Create());
+  // Identify the writer in the footer unless the caller already set it.
+  properties.try_emplace(
+      std::string(StandardPuffinProperties::kCreatedBy),
+      std::format("iceberg-cpp/{}.{}.{}", ICEBERG_VERSION_MAJOR, 
ICEBERG_VERSION_MINOR,
+                  ICEBERG_VERSION_PATCH));

Review Comment:
   `std::format(...)` is evaluated unconditionally here, even when the caller 
already provided a `created-by` property. That adds avoidable work (and a 
potential exception/alloc failure path) on the override case; checking for 
presence first keeps the “caller takes precedence” behavior while avoiding the 
formatting cost.



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