zjw1111 commented on code in PR #224:
URL: https://github.com/apache/paimon-cpp/pull/224#discussion_r3861420733


##########
src/paimon/core/operation/key_value_file_store_write.cpp:
##########
@@ -109,19 +124,74 @@ Result<std::shared_ptr<BatchWriter>> 
KeyValueFileStoreWrite::CreateWriter(
     PAIMON_ASSIGN_OR_RAISE(
         std::shared_ptr<Levels> levels,
         Levels::Create(key_comparator_, restore_data_files, 
options_.GetNumLevels()));
-    auto compact_strategy = compact_manager_factory_->CreateCompactStrategy();
-    PAIMON_ASSIGN_OR_RAISE(
-        std::shared_ptr<CompactManager> compact_manager,
-        compact_manager_factory_->CreateCompactManager(partition, bucket, 
compact_strategy,
-                                                       compact_executor_, 
levels, dv_maintainer));
+    std::map<std::string, std::string> partition_map;
+    std::shared_ptr<CompactManager> compact_manager;
+    std::shared_ptr<RealtimeContextImpl> realtime_context_impl;
+    std::optional<RealtimeStoreState> realtime_store_state;
+    if (realtime_context_) {
+        std::vector<std::pair<std::string, std::string>> partition_values;
+        PAIMON_ASSIGN_OR_RAISE(partition_values,
+                               
file_store_path_factory_->GeneratePartitionVector(partition));
+        partition_map =
+            std::map<std::string, std::string>(partition_values.begin(), 
partition_values.end());
+        PAIMON_ASSIGN_OR_RAISE(realtime_context_impl, 
RealtimeContextImpl::Cast(realtime_context_));
+        if (schema_->GetFieldByName(SpecialFields::RealtimeOffset().Name())) {
+            return Status::Invalid("PK real-time write schema contains 
reserved transport field " +
+                                   SpecialFields::RealtimeOffset().Name());
+        }
+        arrow::FieldVector prepared_fields = {

Review Comment:
   Could we centralize construction of the prepared transport schema in 
`src/paimon/common/table/special_fields.h` ? The same special-field prefix and 
nullability contract is currently assembled here, in 
`RealtimePrimaryKeyWriter`, and in `KeyValueTableRead`, while 
`PreparedKeyValueReader` separately hard-codes the corresponding indexes. This 
is part of the public plugin protocol, so a single helper would prevent the 
write, commit, and query paths from drifting.



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