You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@horaedb.apache.org by "zealchen (via GitHub)" <gi...@apache.org> on 2024/07/17 05:55:22 UTC

[PR] refactor insert select to stream mode [horaedb]

zealchen opened a new pull request, #1544:
URL: https://github.com/apache/horaedb/pull/1544

   ## Rationale
   #1542 
   
   ## Detailed Changes
   Do select and insert procedure in stream way.
   
   ## Test Plan
   CI test.


-- 
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: commits-unsubscribe@horaedb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@horaedb.apache.org
For additional commands, e-mail: commits-help@horaedb.apache.org


Re: [PR] refactor: insert select to stream mode [horaedb]

Posted by "jiacai2050 (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@horaedb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@horaedb.apache.org
For additional commands, e-mail: commits-help@horaedb.apache.org


Re: [PR] refactor: insert select to stream mode [horaedb]

Posted by "jiacai2050 (via GitHub)" <gi...@apache.org>.
jiacai2050 merged PR #1544:
URL: https://github.com/apache/horaedb/pull/1544


-- 
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: commits-unsubscribe@horaedb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@horaedb.apache.org
For additional commands, e-mail: commits-help@horaedb.apache.org


Re: [PR] refactor: insert select to stream mode [horaedb]

Posted by "zealchen (via GitHub)" <gi...@apache.org>.
zealchen commented on PR #1544:
URL: https://github.com/apache/horaedb/pull/1544#issuecomment-2234480859

   Refactor to do the select and insert in parallel way.


-- 
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: commits-unsubscribe@horaedb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@horaedb.apache.org
For additional commands, e-mail: commits-help@horaedb.apache.org