@@ -4722,28 +4722,27 @@ def test_filter_batch(self):
47224722 result = filter_batch (batch , 's.age > t.age' )
47234723 self .assertEqual (result .column ('s.id' ).to_pylist (), [2 , 3 ])
47244724
4725+ @unittest .skipIf (_SKIP_CONDITION , _SKIP_REASON )
47254726 def test_filter_batch_preserves_partition_order (self ):
47264727 from pypaimon .ray .merge_condition import filter_batch
47274728
4728- first = pa .record_batch ({'t.id' : pa .array ([0 ])})
4729- second = pa .record_batch ({'t.id' : pa .array ([1 ])})
4730- dataframe = Mock ()
4731- dataframe .collect .return_value = [second , first ]
4732- dataframe .collect_partitioned .return_value = [[first ], [second ]]
4733- context = Mock ()
4734- context .sql .return_value = dataframe
4735- fake_datafusion = Mock ()
4736- fake_datafusion .SessionContext .return_value = context
4737- source = pa .Table .from_batches ([first , second ])
4729+ batch_size = 20_000
4730+ expected = list (range (4 * batch_size ))
4731+ source = pa .table ({
4732+ 't.id' : pa .chunked_array ([
4733+ pa .array (
4734+ range (i * batch_size , (i + 1 ) * batch_size ),
4735+ type = pa .int64 (),
4736+ )
4737+ for i in range (4 )
4738+ ]),
4739+ })
47384740
4739- with patch (
4740- 'pypaimon.ray.merge_condition._load_datafusion' ,
4741- return_value = fake_datafusion ,
4742- ):
4743- result = filter_batch (source , 'TRUE' , _pre_rewritten = True )
4741+ result = filter_batch (
4742+ source , '"t.id" >= 0' , _pre_rewritten = True ,
4743+ )
47444744
4745- self .assertEqual (result .column ('t.id' ).to_pylist (), [0 , 1 ])
4746- dataframe .collect .assert_not_called ()
4745+ self .assertEqual (result .column ('t.id' ).to_pylist (), expected )
47474746
47484747 @unittest .skipIf (_SKIP_CONDITION , _SKIP_REASON )
47494748 def test_filter_batch_preserves_large_offset_chunks (self ):
0 commit comments