@@ -96,6 +96,7 @@ fn array_cat(exprs: Vec<PyExpr>) -> PyExpr {
96
96
}
97
97
98
98
#[ pyfunction]
99
+ #[ pyo3( signature = ( array, element, index=None ) ) ]
99
100
fn array_position ( array : PyExpr , element : PyExpr , index : Option < i64 > ) -> PyExpr {
100
101
let index = ScalarValue :: Int64 ( index) ;
101
102
let index = Expr :: Literal ( index) ;
@@ -104,6 +105,7 @@ fn array_position(array: PyExpr, element: PyExpr, index: Option<i64>) -> PyExpr
104
105
}
105
106
106
107
#[ pyfunction]
108
+ #[ pyo3( signature = ( array, begin, end, stride=None ) ) ]
107
109
fn array_slice ( array : PyExpr , begin : PyExpr , end : PyExpr , stride : Option < PyExpr > ) -> PyExpr {
108
110
datafusion:: functions_nested:: expr_fn:: array_slice (
109
111
array. into ( ) ,
@@ -142,16 +144,19 @@ fn concat_ws(sep: String, args: Vec<PyExpr>) -> PyResult<PyExpr> {
142
144
}
143
145
144
146
#[ pyfunction]
147
+ #[ pyo3( signature = ( values, regex, flags=None ) ) ]
145
148
fn regexp_like ( values : PyExpr , regex : PyExpr , flags : Option < PyExpr > ) -> PyResult < PyExpr > {
146
149
Ok ( functions:: expr_fn:: regexp_like ( values. expr , regex. expr , flags. map ( |x| x. expr ) ) . into ( ) )
147
150
}
148
151
149
152
#[ pyfunction]
153
+ #[ pyo3( signature = ( values, regex, flags=None ) ) ]
150
154
fn regexp_match ( values : PyExpr , regex : PyExpr , flags : Option < PyExpr > ) -> PyResult < PyExpr > {
151
155
Ok ( functions:: expr_fn:: regexp_match ( values. expr , regex. expr , flags. map ( |x| x. expr ) ) . into ( ) )
152
156
}
153
157
154
158
#[ pyfunction]
159
+ #[ pyo3( signature = ( string, pattern, replacement, flags=None ) ) ]
155
160
/// Replaces substring(s) matching a POSIX regular expression.
156
161
fn regexp_replace (
157
162
string : PyExpr ,
@@ -283,6 +288,7 @@ fn find_window_fn(name: &str, ctx: Option<PySessionContext>) -> PyResult<WindowF
283
288
284
289
/// Creates a new Window function expression
285
290
#[ pyfunction]
291
+ #[ pyo3( signature = ( name, args, partition_by=None , order_by=None , window_frame=None , ctx=None ) ) ]
286
292
fn window (
287
293
name : & str ,
288
294
args : Vec < PyExpr > ,
@@ -331,6 +337,7 @@ macro_rules! aggregate_function {
331
337
} ;
332
338
( $NAME: ident, $( $arg: ident) * ) => {
333
339
#[ pyfunction]
340
+ #[ pyo3( signature = ( $( $arg) ,* , distinct=None , filter=None , order_by=None , null_treatment=None ) ) ]
334
341
fn $NAME(
335
342
$( $arg: PyExpr ) ,* ,
336
343
distinct: Option <bool >,
@@ -351,6 +358,7 @@ macro_rules! aggregate_function_vec_args {
351
358
} ;
352
359
( $NAME: ident, $( $arg: ident) * ) => {
353
360
#[ pyfunction]
361
+ #[ pyo3( signature = ( $( $arg) ,* , distinct=None , filter=None , order_by=None , null_treatment=None ) ) ]
354
362
fn $NAME(
355
363
$( $arg: PyExpr ) ,* ,
356
364
distinct: Option <bool >,
@@ -624,6 +632,7 @@ aggregate_function!(approx_median);
624
632
// aggregate_function!(grouping);
625
633
626
634
#[ pyfunction]
635
+ #[ pyo3( signature = ( expression, percentile, num_centroids=None , filter=None ) ) ]
627
636
pub fn approx_percentile_cont (
628
637
expression : PyExpr ,
629
638
percentile : f64 ,
@@ -642,6 +651,7 @@ pub fn approx_percentile_cont(
642
651
}
643
652
644
653
#[ pyfunction]
654
+ #[ pyo3( signature = ( expression, weight, percentile, filter=None ) ) ]
645
655
pub fn approx_percentile_cont_with_weight (
646
656
expression : PyExpr ,
647
657
weight : PyExpr ,
@@ -662,6 +672,7 @@ aggregate_function_vec_args!(last_value);
662
672
// We handle first_value explicitly because the signature expects an order_by
663
673
// https://github.com/apache/datafusion/issues/12376
664
674
#[ pyfunction]
675
+ #[ pyo3( signature = ( expr, distinct=None , filter=None , order_by=None , null_treatment=None ) ) ]
665
676
pub fn first_value (
666
677
expr : PyExpr ,
667
678
distinct : Option < bool > ,
@@ -677,6 +688,7 @@ pub fn first_value(
677
688
678
689
// nth_value requires a non-expr argument
679
690
#[ pyfunction]
691
+ #[ pyo3( signature = ( expr, n, distinct=None , filter=None , order_by=None , null_treatment=None ) ) ]
680
692
pub fn nth_value (
681
693
expr : PyExpr ,
682
694
n : i64 ,
@@ -691,6 +703,7 @@ pub fn nth_value(
691
703
692
704
// string_agg requires a non-expr argument
693
705
#[ pyfunction]
706
+ #[ pyo3( signature = ( expr, delimiter, distinct=None , filter=None , order_by=None , null_treatment=None ) ) ]
694
707
pub fn string_agg (
695
708
expr : PyExpr ,
696
709
delimiter : String ,
@@ -730,6 +743,7 @@ fn add_builder_fns_to_window(
730
743
}
731
744
732
745
#[ pyfunction]
746
+ #[ pyo3( signature = ( arg, shift_offset, default_value=None , partition_by=None , order_by=None ) ) ]
733
747
pub fn lead (
734
748
arg : PyExpr ,
735
749
shift_offset : i64 ,
@@ -743,6 +757,7 @@ pub fn lead(
743
757
}
744
758
745
759
#[ pyfunction]
760
+ #[ pyo3( signature = ( arg, shift_offset, default_value=None , partition_by=None , order_by=None ) ) ]
746
761
pub fn lag (
747
762
arg : PyExpr ,
748
763
shift_offset : i64 ,
@@ -756,13 +771,15 @@ pub fn lag(
756
771
}
757
772
758
773
#[ pyfunction]
774
+ #[ pyo3( signature = ( partition_by=None , order_by=None ) ) ]
759
775
pub fn rank ( partition_by : Option < Vec < PyExpr > > , order_by : Option < Vec < PyExpr > > ) -> PyResult < PyExpr > {
760
776
let window_fn = window_function:: rank ( ) ;
761
777
762
778
add_builder_fns_to_window ( window_fn, partition_by, order_by)
763
779
}
764
780
765
781
#[ pyfunction]
782
+ #[ pyo3( signature = ( partition_by=None , order_by=None ) ) ]
766
783
pub fn dense_rank (
767
784
partition_by : Option < Vec < PyExpr > > ,
768
785
order_by : Option < Vec < PyExpr > > ,
@@ -773,6 +790,7 @@ pub fn dense_rank(
773
790
}
774
791
775
792
#[ pyfunction]
793
+ #[ pyo3( signature = ( partition_by=None , order_by=None ) ) ]
776
794
pub fn percent_rank (
777
795
partition_by : Option < Vec < PyExpr > > ,
778
796
order_by : Option < Vec < PyExpr > > ,
@@ -783,6 +801,7 @@ pub fn percent_rank(
783
801
}
784
802
785
803
#[ pyfunction]
804
+ #[ pyo3( signature = ( partition_by=None , order_by=None ) ) ]
786
805
pub fn cume_dist (
787
806
partition_by : Option < Vec < PyExpr > > ,
788
807
order_by : Option < Vec < PyExpr > > ,
@@ -793,6 +812,7 @@ pub fn cume_dist(
793
812
}
794
813
795
814
#[ pyfunction]
815
+ #[ pyo3( signature = ( arg, partition_by=None , order_by=None ) ) ]
796
816
pub fn ntile (
797
817
arg : PyExpr ,
798
818
partition_by : Option < Vec < PyExpr > > ,
0 commit comments