You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/10/10 18:50:56 UTC

[GitHub] [arrow] andygrove opened a new pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

andygrove opened a new pull request #8428:
URL: https://github.com/apache/arrow/pull/8428


   


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

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



[GitHub] [arrow] github-actions[bot] commented on pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8428:
URL: https://github.com/apache/arrow/pull/8428#issuecomment-706596920


   https://issues.apache.org/jira/browse/ARROW-10251


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

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



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #8428:
URL: https://github.com/apache/arrow/pull/8428#discussion_r502822633



##########
File path: rust/datafusion/src/datasource/memory.rs
##########
@@ -59,13 +61,22 @@ impl MemTable {
     pub async fn load(t: &dyn TableProvider, batch_size: usize) -> Result<Self> {
         let schema = t.schema();
         let exec = t.scan(&None, batch_size)?;
+        let partition_count = exec.output_partitioning().partition_count();
+
+        let mut tasks = Vec::with_capacity(partition_count);
+        for partition in 0..partition_count {
+            let exec = exec.clone();
+            let task: JoinHandle<Result<Vec<RecordBatch>>> = task::spawn(async move {
+                let it = exec.execute(partition).await?;
+                Ok(it.into_iter().collect::<ArrowResult<Vec<RecordBatch>>>()?)

Review comment:
       (I have not tested this)




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

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



[GitHub] [arrow] andygrove edited a comment on pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
andygrove edited a comment on pull request #8428:
URL: https://github.com/apache/arrow/pull/8428#issuecomment-706595614


   For the TPCH benchmark with `--mem-table` this gave me ~10x speedup in load times. fyi @jhorstmann 
   
   ```
   Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/s1/parquet", file_format: "parquet", mem_table: true }
   Loading data into memory
   Loaded data into memory in 486 ms
   Query 1 iteration 0 took 166 ms
   Query 1 iteration 1 took 154 ms
   Query 1 iteration 2 took 156 ms
   ```


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

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



[GitHub] [arrow] andygrove closed pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
andygrove closed pull request #8428:
URL: https://github.com/apache/arrow/pull/8428


   


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

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



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #8428:
URL: https://github.com/apache/arrow/pull/8428#discussion_r502821593



##########
File path: rust/datafusion/src/datasource/memory.rs
##########
@@ -59,13 +61,22 @@ impl MemTable {
     pub async fn load(t: &dyn TableProvider, batch_size: usize) -> Result<Self> {
         let schema = t.schema();
         let exec = t.scan(&None, batch_size)?;
+        let partition_count = exec.output_partitioning().partition_count();
+
+        let mut tasks = Vec::with_capacity(partition_count);
+        for partition in 0..partition_count {
+            let exec = exec.clone();
+            let task: JoinHandle<Result<Vec<RecordBatch>>> = task::spawn(async move {
+                let it = exec.execute(partition).await?;
+                Ok(it.into_iter().collect::<ArrowResult<Vec<RecordBatch>>>()?)

Review comment:
       ```suggestion
                   it.into_iter().collect::<ArrowResult<Vec<RecordBatch>>>()
   ```

##########
File path: rust/datafusion/src/datasource/memory.rs
##########
@@ -59,13 +61,22 @@ impl MemTable {
     pub async fn load(t: &dyn TableProvider, batch_size: usize) -> Result<Self> {
         let schema = t.schema();
         let exec = t.scan(&None, batch_size)?;
+        let partition_count = exec.output_partitioning().partition_count();
+
+        let mut tasks = Vec::with_capacity(partition_count);
+        for partition in 0..partition_count {
+            let exec = exec.clone();
+            let task: JoinHandle<Result<Vec<RecordBatch>>> = task::spawn(async move {
+                let it = exec.execute(partition).await?;
+                Ok(it.into_iter().collect::<ArrowResult<Vec<RecordBatch>>>()?)
+            });
+            tasks.push(task)
+        }
 
-        let mut data: Vec<Vec<RecordBatch>> =
-            Vec::with_capacity(exec.output_partitioning().partition_count());
-        for partition in 0..exec.output_partitioning().partition_count() {
-            let it = exec.execute(partition).await?;
-            let partition_batches = it.into_iter().collect::<ArrowResult<Vec<_>>>()?;
-            data.push(partition_batches);
+        let mut data: Vec<Vec<RecordBatch>> = Vec::with_capacity(partition_count);
+        for task in tasks {
+            let result = task.await.unwrap()?;

Review comment:
       ```suggestion
               let result = task.await.expect("To have some data on every recordBatch")?;
   ```




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

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



[GitHub] [arrow] andygrove commented on pull request #8428: ARROW-10251: [Rust] [DataFusion] MemTable::load() now loads partitions in parallel

Posted by GitBox <gi...@apache.org>.
andygrove commented on pull request #8428:
URL: https://github.com/apache/arrow/pull/8428#issuecomment-706595614


   For the TPCH benchmark with `--mem-table` this gave me ~10x speedup in load times. fyi @jhorstmann 


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

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