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


##########
src/paimon/core/io/data_file_meta_write_cols_legacy_serializer.cpp:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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/core/io/data_file_meta_write_cols_legacy_serializer.h"
+
+#include <cassert>
+#include <cstdint>
+#include <optional>
+#include <string>
+#include <utility>
+
+#include "arrow/type.h"
+#include "paimon/common/data/binary_row_writer.h"
+#include "paimon/common/data/binary_string.h"
+#include "paimon/common/data/internal_row.h"
+#include "paimon/common/utils/internal_row_utils.h"
+#include "paimon/common/utils/serialization_utils.h"
+#include "paimon/core/manifest/file_source.h"
+#include "paimon/core/stats/simple_stats.h"
+#include "paimon/data/timestamp.h"
+#include "paimon/status.h"
+
+namespace paimon {
+
+class Bytes;
+class InternalArray;
+
+const std::shared_ptr<arrow::DataType>& 
DataFileMetaWriteColsLegacySerializer::DataType() {
+    static const std::shared_ptr<arrow::DataType> legacy_type = []() {
+        auto current_type = 
std::static_pointer_cast<arrow::StructType>(DataFileMeta::DataType());
+        auto fields = current_type->fields();
+        fields.pop_back();

Review Comment:
    Could we define this legacy schema independently instead of deriving it by 
removing the last field from the current schema?
   
   This works while `DataFileMeta::DataType()` has exactly 21 fields. If 
another field is appended later, `pop_back()` will leave 21 fields and silently 
change the schema used to deserialize DataSplit v8 and CommitMessage v9–12.
   
   The Java implementation freezes the previous layout by explicitly projecting 
the original 20 fields. We should do the same here, or at least resize to 
exactly 20 fields and verify that the last retained field is `_WRITE_COLS`.



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