charlesdong1991 commented on code in PR #614:
URL: https://github.com/apache/fluss-rust/pull/614#discussion_r3407860111


##########
crates/fluss/src/client/table/batch_scanner.rs:
##########
@@ -211,17 +202,21 @@ fn decode_log_batch(
 
     let base_offset = base_offset.unwrap_or(0);
     let merged = if batches.is_empty() {
-        RecordBatch::new_empty(target_schema)
+        RecordBatch::new_empty(full_schema)
     } else if batches.len() == 1 {
         batches.into_iter().next().unwrap()
     } else {
-        concat_batches(&target_schema, batches.iter()).map_err(|e| 
Error::UnexpectedError {
+        concat_batches(&full_schema, batches.iter()).map_err(|e| 
Error::UnexpectedError {
             message: format!("Failed to concatenate log record batches: {e}"),
             source: None,
         })?
     };
 
-    Ok(take_last_rows(merged, base_offset, limit))
+    let (trimmed, base_offset) = take_last_rows(merged, base_offset, limit);
+    Ok((
+        project_batch(trimmed, table_info.get_row_type(), projected_fields)?,

Review Comment:
   this rust-core change now decodes full server respones and project 
client-side, which is right! 
   
   Nit: can we add a test here using non-prefix projection which is never the 
case and not tested before? but completely nit, and can be follow-up pr



##########
crates/fluss/src/client/table/batch_scanner.rs:
##########
@@ -211,17 +202,21 @@ fn decode_log_batch(
 
     let base_offset = base_offset.unwrap_or(0);
     let merged = if batches.is_empty() {
-        RecordBatch::new_empty(target_schema)
+        RecordBatch::new_empty(full_schema)
     } else if batches.len() == 1 {
         batches.into_iter().next().unwrap()
     } else {
-        concat_batches(&target_schema, batches.iter()).map_err(|e| 
Error::UnexpectedError {
+        concat_batches(&full_schema, batches.iter()).map_err(|e| 
Error::UnexpectedError {
             message: format!("Failed to concatenate log record batches: {e}"),
             source: None,
         })?
     };
 
-    Ok(take_last_rows(merged, base_offset, limit))
+    let (trimmed, base_offset) = take_last_rows(merged, base_offset, limit);
+    Ok((
+        project_batch(trimmed, table_info.get_row_type(), projected_fields)?,

Review Comment:
   this rust-core change now decodes full server respones and project 
client-side, which is right! 
   
   Nit: can we add a test here using non-prefix projection which is never the 
case and not tested before? but completely nit, and can be follow-up pr or 
safely ignore



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