@@ -4814,9 +4814,13 @@ mod tests {
48144814 Ok ( ( ) )
48154815 }
48164816
4817+ #[ apply( hash_join_exec_configs) ]
48174818 #[ tokio:: test]
4818- async fn join_inner_one_two_parts_left_randomly_ordered ( ) -> Result < ( ) > {
4819- let task_ctx = Arc :: new ( TaskContext :: default ( ) ) ;
4819+ async fn join_inner_one_two_parts_left_randomly_ordered (
4820+ batch_size : usize ,
4821+ use_perfect_hash_join_as_possible : bool ,
4822+ ) -> Result < ( ) > {
4823+ let task_ctx = prepare_task_ctx ( batch_size, use_perfect_hash_join_as_possible) ;
48204824 let batch1 = build_table_i32 (
48214825 ( "a1" , & vec ! [ 0 , 3 ] ) ,
48224826 ( "b1" , & vec ! [ 4 , 5 ] ) ,
@@ -4870,6 +4874,7 @@ mod tests {
48704874 }
48714875
48724876 assert_join_metrics ! ( metrics, 4 ) ;
4877+ assert_phj_used ( & metrics, use_perfect_hash_join_as_possible) ;
48734878
48744879 Ok ( ( ) )
48754880 }
@@ -4998,8 +5003,9 @@ mod tests {
49985003 TestMemoryExec :: try_new_exec ( & [ vec ! [ batch. clone( ) , batch] ] , schema, None ) . unwrap ( )
49995004 }
50005005
5001- /// Unmatched build rows of a `LeftAnti` join are emitted in build index
5002- /// order, so the concatenated build batch must keep the input batch order.
5006+ /// The hash map and array map paths must emit unmatched build rows of a
5007+ /// `LeftAnti` join in the same order. Build order is not a plan-level
5008+ /// guarantee (see #26235).
50035009 #[ apply( hash_join_exec_configs) ]
50045010 #[ tokio:: test]
50055011 async fn join_left_anti_keeps_build_order_across_batches (
@@ -5054,67 +5060,6 @@ mod tests {
50545060 Ok ( ( ) )
50555061 }
50565062
5057- /// Build rows sharing a key across build batches are matched in build
5058- /// order, which relies on the hash map chains putting smaller build
5059- /// indices first.
5060- #[ apply( hash_join_exec_configs) ]
5061- #[ tokio:: test]
5062- async fn join_inner_keeps_build_order_for_duplicate_keys_across_batches (
5063- batch_size : usize ,
5064- use_perfect_hash_join_as_possible : bool ,
5065- ) -> Result < ( ) > {
5066- let task_ctx = prepare_task_ctx ( batch_size, use_perfect_hash_join_as_possible) ;
5067- let batch1 = build_table_i32 (
5068- ( "a1" , & vec ! [ 1 , 2 ] ) ,
5069- ( "b1" , & vec ! [ 5 , 6 ] ) ,
5070- ( "c1" , & vec ! [ 7 , 8 ] ) ,
5071- ) ;
5072- let batch2 = build_table_i32 (
5073- ( "a1" , & vec ! [ 3 , 4 ] ) ,
5074- ( "b1" , & vec ! [ 5 , 6 ] ) ,
5075- ( "c1" , & vec ! [ 9 , 10 ] ) ,
5076- ) ;
5077- let schema = batch1. schema ( ) ;
5078- let left =
5079- TestMemoryExec :: try_new_exec ( & [ vec ! [ batch1, batch2] ] , schema, None ) . unwrap ( ) ;
5080- let right = build_table (
5081- ( "a2" , & vec ! [ 10 , 20 ] ) ,
5082- ( "b1" , & vec ! [ 5 , 6 ] ) ,
5083- ( "c2" , & vec ! [ 70 , 80 ] ) ,
5084- ) ;
5085- let on = vec ! [ (
5086- Arc :: new( Column :: new_with_schema( "b1" , & left. schema( ) ) ?) as _,
5087- Arc :: new( Column :: new_with_schema( "b1" , & right. schema( ) ) ?) as _,
5088- ) ] ;
5089-
5090- let ( columns, batches, metrics) = join_collect (
5091- left,
5092- right,
5093- on,
5094- & JoinType :: Inner ,
5095- NullEquality :: NullEqualsNothing ,
5096- task_ctx,
5097- )
5098- . await ?;
5099-
5100- assert_eq ! ( columns, vec![ "a1" , "b1" , "c1" , "a2" , "b1" , "c2" ] ) ;
5101- allow_duplicates ! {
5102- assert_snapshot!( batches_to_string( & batches) , @r"
5103- +----+----+----+----+----+----+
5104- | a1 | b1 | c1 | a2 | b1 | c2 |
5105- +----+----+----+----+----+----+
5106- | 1 | 5 | 7 | 10 | 5 | 70 |
5107- | 3 | 5 | 9 | 10 | 5 | 70 |
5108- | 2 | 6 | 8 | 20 | 6 | 80 |
5109- | 4 | 6 | 10 | 20 | 6 | 80 |
5110- +----+----+----+----+----+----+
5111- " ) ;
5112- }
5113- assert_phj_used ( & metrics, use_perfect_hash_join_as_possible) ;
5114-
5115- Ok ( ( ) )
5116- }
5117-
51185063 /// `probe_hit_rate` and `avg_fanout` must count each probe row once, even
51195064 /// when a probe batch is processed in several chunks. Every probe row matches
51205065 /// all 3 build rows, so any `batch_size` below 9 splits the probe batch into
0 commit comments