[ 
https://issues.apache.org/jira/browse/ARROW-11030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Grove updated ARROW-11030:
-------------------------------
    Comment: was deleted

(was: Batch size 131072:
{code:java}
[2020-12-28T20:46:28Z DEBUG datafusion::physical_plan::hash_join] Built 
build-side of hash join containing 3115341 rows in 9926 ms
[2020-12-28T20:46:36Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 388922 rows in 7994 ms
[2020-12-28T20:46:36Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 389294 rows in 7986 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 389558 rows in 8326 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 388841 rows in 8499 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 390056 rows in 8643 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18749999 rows and produced 144 output 
batches containing 389143 rows in 8711 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 389605 rows in 8712 ms
[2020-12-28T20:46:37Z DEBUG datafusion::physical_plan::hash_join] Processed 144 
stream-side input batches containing 18750000 rows and produced 144 output 
batches containing 389922 rows in 8877 ms
+------------+-----------------+----------------+
| l_shipmode | high_line_count | low_line_count |
+------------+-----------------+----------------+
| MAIL       | 623115          | 934713         |
| SHIP       | 622979          | 934534         |
+------------+-----------------+----------------+
Query 12 iteration 0 took 19559.0 ms
 {code}
Batch size 32768:
{code:java}
 [2020-12-28T20:51:47Z DEBUG datafusion::physical_plan::hash_join] Built 
build-side of hash join containing 3115341 rows in 9442 ms
[2020-12-28T20:52:33Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 390056 rows in 45356 ms
[2020-12-28T20:52:35Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 388841 rows in 46748 ms
[2020-12-28T20:52:35Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 389558 rows in 47684 ms
[2020-12-28T20:52:36Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 389922 rows in 48124 ms
[2020-12-28T20:52:37Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18749999 rows and produced 573 output 
batches containing 389143 rows in 49278 ms
[2020-12-28T20:52:39Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 388922 rows in 50871 ms
[2020-12-28T20:52:39Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 389605 rows in 51220 ms
[2020-12-28T20:52:40Z DEBUG datafusion::physical_plan::hash_join] Processed 573 
probe-side input batches containing 18750000 rows and produced 573 output 
batches containing 389294 rows in 51843 ms
+------------+-----------------+----------------+
| l_shipmode | high_line_count | low_line_count |
+------------+-----------------+----------------+
| MAIL       | 623115          | 934713         |
| SHIP       | 622979          | 934534         |
+------------+-----------------+----------------+
Query 12 iteration 0 took 62321.3 ms{code})

> [Rust] [DataFusion] Poor join performance with smaller batches
> --------------------------------------------------------------
>
>                 Key: ARROW-11030
>                 URL: https://issues.apache.org/jira/browse/ARROW-11030
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust - DataFusion
>            Reporter: Andy Grove
>            Assignee: Andy Grove
>            Priority: Major
>             Fix For: 3.0.0
>
>
> Performance of joins slows down dramatically with smaller batches.
> The issue is related to slow performance of MutableDataArray::new() when 
> passed a high number of batches. This happens when passing in all of the 
> batches from the build side of the join and this happens once per build-side 
> join key for each probe-side batch.
> It seems to be an O(N) cost as the number of arrays increases even though the 
> number of rows is the same.
> I modified hash_join.rs to have this debug code:
> {code:java}
> let start = Instant::now();
> let row_count: usize = arrays.iter().map(|arr| arr.len()).sum();
> let num_arrays = arrays.len();
> let mut mutable = MutableArrayData::new(arrays, true, capacity);
> if num_arrays > 0 {
>     debug!("MutableArrayData::new() with {} arrays containing {} rows took {} 
> ms", num_arrays, row_count, start.elapsed().as_millis());
> } {code}
> Batch size 131072:
> {code:java}
> MutableArrayData::new() with 4584 arrays containing 3115341 rows took 1 ms
> MutableArrayData::new() with 4584 arrays containing 3115341 rows took 1 ms
> MutableArrayData::new() with 4584 arrays containing 3115341 rows took 1 ms 
> {code}
> Batch size 16384:
> {code:java}
> MutableArrayData::new() with 36624 arrays containing 3115341 rows took 19 ms
> MutableArrayData::new() with 36624 arrays containing 3115341 rows took 16 ms
> MutableArrayData::new() with 36624 arrays containing 3115341 rows took 17 ms 
> {code}
> Batch size 4096:
> {code:java}
> MutableArrayData::new() with 146496 arrays containing 3115341 rows took 88 ms
> MutableArrayData::new() with 146496 arrays containing 3115341 rows took 89 ms
> MutableArrayData::new() with 146496 arrays containing 3115341 rows took 88 ms 
> {code}
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to