2010YOUY01 commented on PR #21775:
URL: https://github.com/apache/datafusion/pull/21775#issuecomment-4362636504

   Thank you—this is a great observation and optimization.
   
   - I suggest adding a few micro-benchmarks to 
https://github.com/apache/datafusion/blob/main/benchmarks/src/hj.rs, as it’s 
hard to see the impact in complex workloads like TPC-H.
   
   - Also, there is a minor `explain analyze` metric regression, it seems 
`probe_hit_rate` and `avg_fanout` is not tracked in the fast path
   
   (Result from PR branch in `datafusion-cli`, `main` got a different expected 
value for those two metrics)
   ```
   > explain analyze select *
   from generate_series(10000000) as t1(v1)
   right semi join generate_series(10000000) as t2(v1)
   on t1.v1 = t2.v1;
   
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type         | plan                                                   
                                                                                
                                                                                
                                                                                
                                                                                
                                       |
   
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Plan with Metrics | HashJoinExec: mode=Partitioned, join_type=RightSemi, 
on=[(v1@0, v1@0)], metrics=[output_rows=10.00 M, elapsed_compute=715.88ms, 
output_bytes=77.0 MB, output_batches=1.23 K, array_map_created_count=0, 
build_input_batches=1.23 K, build_input_rows=10.00 M, input_batches=1.23 K, 
input_rows=10.00 M, build_mem_used=330.3 M, build_time=286.08ms, 
join_time=389.82ms, avg_fanout=N/A (0/0), probe_hit_rate=0% (0/10.00 M)] |
   
   ```
   
   - Additionally, to further optimize this in the future, probably we can 
create a new hash map implementation that avoids inserting duplicates at the 
building phase, this way both build time and probe time can be optimized, also 
the solution seem to be simpler since we won't need a new probe method for only 
finding the first match.


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