You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/05 10:51:13 UTC

[GitHub] [arrow-datafusion] alamb commented on a change in pull request #505: Wrong aggregation arguments error.

alamb commented on a change in pull request #505:
URL: https://github.com/apache/arrow-datafusion/pull/505#discussion_r645975983



##########
File path: datafusion/tests/sql.rs
##########
@@ -3437,3 +3437,14 @@ async fn test_physical_plan_display_indent_multi_children() {
         expected, actual
     );
 }
+
+#[tokio::test]
+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(())

Review comment:
       You can test the actual error message too if you want like this (untested):
   
   ```suggestion
       let err = physical_plan.unwrap_err();
       assert_eq!(err.to_string(), "Invalid or wrong number of arguments passed to aggregate: 'COUNT'");
       Ok(())
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org