-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Wrong aggregation arguments error. #505
Conversation
Codecov Report
@@ Coverage Diff @@
## master #505 +/- ##
==========================================
+ Coverage 75.92% 76.08% +0.16%
==========================================
Files 154 155 +1
Lines 26195 26555 +360
==========================================
+ Hits 19889 20205 +316
- Misses 6306 6350 +44
Continue to review full report at Codecov.
|
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.
Can we please also add a test (to sql.rs) that exercises this code path?
@alamb Added this simple test (trying to create a physical plan with the example that you posted in the issue). async fn test_aggregation_with_bad_arguments() -> Result<()> {
let mut ctx = ExecutionContext::new();
register_aggregate_csv(&mut ctx)?;
let sql = "SELECT COUNT(DISTINCT) FROM aggregate_test_100";
let logical_plan = ctx.create_logical_plan(&sql).?;
let physical_plan = ctx.create_physical_plan(&logical_plan);
assert!(physical_plan.is_err());
Ok(())
} |
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.
Looks good to me. Thank you @jgoday
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
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.
Thanks @jgoday -- this is much nicer than panic!
ing :)
Which issue does this PR close?
Closes #496.
Rationale for this change
Check the arguments coerced to an aggregation and return a DataFusionError::Plan if no arguments can be associated with the function call.
Error message will display something like
What changes are included in this PR?
Checks if there are some valid coerced arguments to call an aggregation function in create_aggregate_expr (datafusion/src/physical_plan/aggregates.rs)
Are there any user-facing changes?