Skip to content

Commit

Permalink
Updates type of order_by parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsherin committed Sep 2, 2024
1 parent 88390a0 commit 19bf666
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions datafusion/functions-aggregate/src/nth_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ create_func!(NthValueAgg, nth_value_udaf);
pub fn nth_value(
expr: datafusion_expr::Expr,
n: i64,
order_by: Option<Vec<SortExpr>>,
order_by: Vec<SortExpr>,
) -> datafusion_expr::Expr {
let args = vec![expr, lit(n)];
if let Some(order_by) = order_by {
if !order_by.is_empty() {
nth_value_udaf()
.call(args)
.order_by(order_by)
Expand Down
14 changes: 4 additions & 10 deletions datafusion/proto/tests/cases/roundtrip_logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,23 +904,17 @@ async fn roundtrip_expr_api() -> Result<()> {
vec![lit(10), lit(20), lit(30)],
),
row_number(),
nth_value(col("b"), 1, None),
nth_value(col("b"), 1, vec![]),
nth_value(
col("b"),
1,
Some(vec![
col("a").sort(false, false),
col("b").sort(true, false),
]),
vec![col("a").sort(false, false), col("b").sort(true, false)],
),
nth_value(col("b"), -1, None),
nth_value(col("b"), -1, vec![]),
nth_value(
col("b"),
-1,
Some(vec![
col("a").sort(false, false),
col("b").sort(true, false),
]),
vec![col("a").sort(false, false), col("b").sort(true, false)],
),
];

Expand Down

0 comments on commit 19bf666

Please sign in to comment.