leekeiabstraction commented on code in PR #176:
URL: https://github.com/apache/fluss-rust/pull/176#discussion_r2702258829


##########
crates/fluss/src/client/write/batch.rs:
##########
@@ -237,6 +246,97 @@ impl ArrowLogWriteBatch {
     }
 }
 
+pub struct KvWriteBatch {
+    write_batch: InnerWriteBatch,
+    kv_batch_builder: KvRecordBatchBuilder,
+    target_columns: Option<Vec<usize>>,
+    schema_id: i32,
+}
+
+impl KvWriteBatch {
+    #[allow(clippy::too_many_arguments)]
+    pub fn new(
+        batch_id: i64,

Review Comment:
   Curious on why we need to introduce batch_id here?



##########
crates/fluss/src/rpc/message/produce_log.rs:
##########
@@ -37,7 +37,7 @@ impl ProduceLogRequest {
         table_id: i64,
         ack: i16,
         max_request_timeout_ms: i32,
-        ready_batches: &[&ReadyWriteBatch],
+        ready_batches: &mut [ReadyWriteBatch],

Review Comment:
   Do we need mut here?



##########
crates/fluss/src/client/write/mod.rs:
##########
@@ -33,31 +33,80 @@ mod sender;
 mod write_format;
 mod writer_client;
 
+use crate::client::Record::Compacted;
 pub use write_format::WriteFormat;
 pub use writer_client::WriterClient;
 
+#[allow(dead_code)]
 pub struct WriteRecord<'a> {
-    pub row: Record<'a>,
-    pub table_path: Arc<TablePath>,
+    record: Record<'a>,
+    table_path: Arc<TablePath>,
+    bucket_key: Option<&'a [u8]>,
+    schema_id: i32,
+    write_format: WriteFormat,
+
+    // only valid for primary key table
+    key: Option<&'a [u8]>,
+    target_columns: Option<&'a [usize]>,

Review Comment:
   nit: We can have this in a wrapper structure for CompactedRow, this way the 
complexities isn't exposed to WriteRecords that do not support key / target 
columns.
   
   
   ```rust
   struct CompactedRecord<'a> {
      key: &'a [u8],
      bucket_key: &'a [u8],
      target_columns: &'a [usize],
      row: Option<CompactedRow<'a>>
   }
   pub enum Record<'a> {
       Generic(GenericRow<'a>),
       RecordBatch(Arc<RecordBatch>),
       Compacted(CompactedRecord<'a>),
   }
   ```



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