jiacai2050 commented on code in PR #1544:
URL: https://github.com/apache/horaedb/pull/1544#discussion_r1681229407


##########
src/interpreters/src/insert.rs:
##########
@@ -168,38 +179,98 @@ impl Interpreter for InsertInterpreter {
                 .await
                 .context(Insert)?;
 
-                if record_batches.is_empty() {
-                    return Ok(Output::AffectedRows(0));
+                // accumulate 8 record batches before writing to table and 
this param
+                // can be adjusted according to the performance test result.
+                let max_batch_size = 8;

Review Comment:
   I think `max_row_count` is more suitable here, 1000 is a reasonable default 
value.



##########
src/interpreters/src/insert.rs:
##########
@@ -168,38 +179,98 @@ impl Interpreter for InsertInterpreter {
                 .await
                 .context(Insert)?;
 
-                if record_batches.is_empty() {
-                    return Ok(Output::AffectedRows(0));
+                // accumulate 8 record batches before writing to table and 
this param
+                // can be adjusted according to the performance test result.
+                let max_batch_size = 8;
+                let mut result_rows = 0;
+                let mut record_batches = Vec::new();
+                while let Some(response) = record_batches_stream.next().await {

Review Comment:
   ```rust
   while let Some(response) = record_batches_stream.try_next().await? {
     ...
   }
   ```
   
   This looks more elegant.



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