-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Expr->String for WindowFunction #10243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order_by field in aggregate function and window function is not available now. I plan to do it later.
fn function_args_to_sql(&self, args: &[Expr]) -> Result<Vec<ast::FunctionArg>> { | ||
args.iter() | ||
.map(|e| { | ||
if matches!(e, Expr::Wildcard { qualifier: None }) { | ||
Ok(ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Wildcard)) | ||
} else { | ||
self.expr_to_sql(e) | ||
.map(|e| ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Expr(e))) | ||
} | ||
}) | ||
.collect::<Result<Vec<_>>>() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract a common function for convert function args to ast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yyy1000 -- this looks very nice to me.
} | ||
}) | ||
.collect::<Result<Vec<_>>>()?; | ||
let func_name = agg.func_def.name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
order_by: None, | ||
null_treatment: None, | ||
}), | ||
"COUNT(*) FILTER (WHERE true)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Thanks for your review~ @alamb |
It is great to have you back! |
Which issue does this PR close?
Related #9726 .
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?