@@ -384,34 +384,19 @@ async fn test_fn_approx_median() -> Result<()> {
384384
385385#[ tokio:: test]
386386async fn test_fn_approx_percentile_cont ( ) -> Result < ( ) > {
387- let expr = approx_percentile_cont ( col ( "b" ) . sort ( true , false ) , lit ( 0.5 ) , None ) ;
387+ let expr = approx_percentile_cont ( col ( "b" ) , lit ( 0.5 ) , None ) ;
388388
389389 let df = create_test_table ( ) . await ?;
390390 let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
391391
392392 assert_snapshot ! (
393393 batches_to_string( & batches) ,
394394 @r"
395- +---------------------------------------------------------------------------+
396- | approx_percentile_cont(Float64(0.5)) WITHIN GROUP [test.b ASC NULLS LAST] |
397- +---------------------------------------------------------------------------+
398- | 10 |
399- +---------------------------------------------------------------------------+
400- " ) ;
401-
402- let expr = approx_percentile_cont ( col ( "b" ) . sort ( false , false ) , lit ( 0.1 ) , None ) ;
403-
404- let df = create_test_table ( ) . await ?;
405- let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
406-
407- assert_snapshot ! (
408- batches_to_string( & batches) ,
409- @r"
410- +----------------------------------------------------------------------------+
411- | approx_percentile_cont(Float64(0.1)) WITHIN GROUP [test.b DESC NULLS LAST] |
412- +----------------------------------------------------------------------------+
413- | 100 |
414- +----------------------------------------------------------------------------+
395+ +---------------------------------------------+
396+ | approx_percentile_cont(test.b,Float64(0.5)) |
397+ +---------------------------------------------+
398+ | 10 |
399+ +---------------------------------------------+
415400 " ) ;
416401
417402 // the arg2 parameter is a complex expr, but it can be evaluated to the literal value
@@ -420,71 +405,35 @@ async fn test_fn_approx_percentile_cont() -> Result<()> {
420405 None :: < & str > ,
421406 "arg_2" . to_string ( ) ,
422407 ) ) ;
423- let expr = approx_percentile_cont ( col ( "b" ) . sort ( true , false ) , alias_expr, None ) ;
408+ let expr = approx_percentile_cont ( col ( "b" ) , alias_expr, None ) ;
424409 let df = create_test_table ( ) . await ?;
425410 let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
426411
427412 assert_snapshot ! (
428413 batches_to_string( & batches) ,
429414 @r"
430- +--------------------------------------------------------------------+
431- | approx_percentile_cont(arg_2) WITHIN GROUP [test.b ASC NULLS LAST] |
432- +--------------------------------------------------------------------+
433- | 10 |
434- +--------------------------------------------------------------------+
435- "
436- ) ;
437-
438- let alias_expr = Expr :: Alias ( Alias :: new (
439- cast ( lit ( 0.1 ) , DataType :: Float32 ) ,
440- None :: < & str > ,
441- "arg_2" . to_string ( ) ,
442- ) ) ;
443- let expr = approx_percentile_cont ( col ( "b" ) . sort ( false , false ) , alias_expr, None ) ;
444- let df = create_test_table ( ) . await ?;
445- let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
446-
447- assert_snapshot ! (
448- batches_to_string( & batches) ,
449- @r"
450- +---------------------------------------------------------------------+
451- | approx_percentile_cont(arg_2) WITHIN GROUP [test.b DESC NULLS LAST] |
452- +---------------------------------------------------------------------+
453- | 100 |
454- +---------------------------------------------------------------------+
415+ +--------------------------------------+
416+ | approx_percentile_cont(test.b,arg_2) |
417+ +--------------------------------------+
418+ | 10 |
419+ +--------------------------------------+
455420 "
456421 ) ;
457422
458423 // with number of centroids set
459- let expr = approx_percentile_cont ( col ( "b" ) . sort ( true , false ) , lit ( 0.5 ) , Some ( lit ( 2 ) ) ) ;
460-
461- let df = create_test_table ( ) . await ?;
462- let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
463-
464- assert_snapshot ! (
465- batches_to_string( & batches) ,
466- @r"
467- +------------------------------------------------------------------------------------+
468- | approx_percentile_cont(Float64(0.5),Int32(2)) WITHIN GROUP [test.b ASC NULLS LAST] |
469- +------------------------------------------------------------------------------------+
470- | 30 |
471- +------------------------------------------------------------------------------------+
472- " ) ;
473-
474- let expr =
475- approx_percentile_cont ( col ( "b" ) . sort ( false , false ) , lit ( 0.1 ) , Some ( lit ( 2 ) ) ) ;
424+ let expr = approx_percentile_cont ( col ( "b" ) , lit ( 0.5 ) , Some ( lit ( 2 ) ) ) ;
476425
477426 let df = create_test_table ( ) . await ?;
478427 let batches = df. aggregate ( vec ! [ ] , vec ! [ expr] ) . unwrap ( ) . collect ( ) . await ?;
479428
480429 assert_snapshot ! (
481430 batches_to_string( & batches) ,
482431 @r"
483- +------------------------------------------------------------------------------------- +
484- | approx_percentile_cont(Float64(0.1 ),Int32(2)) WITHIN GROUP [test.b DESC NULLS LAST] |
485- +------------------------------------------------------------------------------------- +
486- | 69 |
487- +------------------------------------------------------------------------------------- +
432+ +------------------------------------------------------+
433+ | approx_percentile_cont(test.b, Float64(0.5 ),Int32(2)) |
434+ +------------------------------------------------------+
435+ | 30 |
436+ +------------------------------------------------------+
488437 " ) ;
489438
490439 Ok ( ( ) )
0 commit comments