Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds macros for creating WindowUDF and WindowFunction expression #12693

Merged
merged 34 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9424f61
Adds macro for udwf singleton
jcsherin Sep 28, 2024
31819af
Adds a doc comment parameter to macro
jcsherin Sep 28, 2024
569b5d6
Add doc comment for `create_udwf` macro
jcsherin Sep 28, 2024
5456413
Uses default constructor
jcsherin Sep 28, 2024
88657cb
Update `Cargo.lock` in `datafusion-cli`
jcsherin Sep 28, 2024
ca6ea44
Fixes: expand `$FN_NAME` in doc strings
jcsherin Sep 28, 2024
0288a36
Adds example for macro usage
jcsherin Sep 29, 2024
2446ffb
Renames macro
jcsherin Sep 29, 2024
771465a
Improve doc comments
jcsherin Sep 29, 2024
b662b28
Rename udwf macro
jcsherin Sep 29, 2024
9e1b375
Minor: doc copy edits
jcsherin Sep 29, 2024
443747e
Adds macro for creating fluent-style expression API
jcsherin Sep 29, 2024
4b747c1
Adds support for 1 or more parameters in expression function
jcsherin Sep 29, 2024
b73356a
Rewrite doc comments
jcsherin Sep 29, 2024
50ae9ef
Rename parameters
jcsherin Sep 29, 2024
8e27029
Minor: formatting
jcsherin Sep 30, 2024
e100bc6
Adds doc comment for `create_udwf_expr` macro
jcsherin Sep 30, 2024
a5f6c2a
Improve example docs
jcsherin Sep 30, 2024
fd70acb
Hides extraneous code in doc comments
jcsherin Sep 30, 2024
5138c61
Add a one-line readme
jcsherin Sep 30, 2024
19cd999
Adds doc test assertions + minor formatting fixes
jcsherin Sep 30, 2024
9dbb94c
Adds common macro for defining user-defined window functions
jcsherin Oct 1, 2024
cadcf68
Adds doc comment for `define_udwf_and_expr`
jcsherin Oct 1, 2024
cafdf56
Defines `RowNumber` using common macro
jcsherin Oct 1, 2024
9ae5caa
Add usage example for common macro
jcsherin Oct 1, 2024
3c8589c
Adds usage for custom constructor
jcsherin Oct 1, 2024
e6b4191
Add examples for remaining patterns
jcsherin Oct 1, 2024
ff24d6a
Improve doc comments for usage examples
jcsherin Oct 1, 2024
09709d3
Rewrite inner line docs
jcsherin Oct 1, 2024
03f8a72
Rewrite `create_udwf_expr!` doc comments
jcsherin Oct 1, 2024
60d5ecc
Minor doc improvements
jcsherin Oct 1, 2024
12197b5
Fix doc test and usage example
jcsherin Oct 1, 2024
4e6ee30
Add inline comments for macro patterns
jcsherin Oct 1, 2024
35e2f1a
Minor: change doc comment in example
jcsherin Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Renames macro
jcsherin committed Sep 29, 2024
commit 2446ffb110ada00014feb6738351531c01702ced
8 changes: 4 additions & 4 deletions datafusion/functions-window/src/macros.rs
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
/// use datafusion_expr::{PartitionEvaluator, Signature, Volatility, WindowUDFImpl};
///
/// use datafusion_functions_window_common::field::WindowUDFFieldArgs;
/// use datafusion_functions_window::create_udwf;
/// use datafusion_functions_window::make_udwf_singleton;
///
/// #[derive(Debug)]
/// struct AddOne {
@@ -76,13 +76,13 @@
///
/// /// This creates a singleton instance of `AddOne` user-defined
/// /// window function named `add_one_udwf()`.
/// create_udwf!(AddOne, add_one, "Adds one to each row value in window partition.");
/// make_udwf_singleton!(AddOne, add_one, "Adds one to each row value in window partition.");
/// ```

#[macro_export]
macro_rules! create_udwf {
macro_rules! make_udwf_singleton {
($STRUCT_NAME:ident, $FN_NAME:ident, $DOC:expr) => {
create_udwf!($STRUCT_NAME, $FN_NAME, $DOC, $STRUCT_NAME::default);
make_udwf_singleton!($STRUCT_NAME, $FN_NAME, $DOC, $STRUCT_NAME::default);
};

($STRUCT_NAME:ident, $FN_NAME:ident, $DOC:expr, $CTOR:path) => {
2 changes: 1 addition & 1 deletion datafusion/functions-window/src/row_number.rs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ use datafusion_expr::{Expr, PartitionEvaluator, Signature, Volatility, WindowUDF
use datafusion_functions_window_common::field;
use field::WindowUDFFieldArgs;

create_udwf!(
make_udwf_singleton!(
RowNumber,
row_number,
"Returns a unique row number for each row in window partition beginning at 1."