alamb commented on a change in pull request #1249:
URL: https://github.com/apache/arrow-datafusion/pull/1249#discussion_r744663284
##########
File path: datafusion/src/physical_plan/functions.rs
##########
@@ -3859,28 +3861,56 @@ mod tests {
}
#[test]
- fn test_concat_error() -> Result<()> {
+ fn test_empty_arguments_error() -> Result<()> {
let ctx_state = ExecutionContextState::new();
let schema = Schema::new(vec![Field::new("a", DataType::Int32,
false)]);
- let expr = create_physical_expr(
- &BuiltinScalarFunction::Concat,
- &[],
- &schema,
- &ctx_state,
- )?;
+ let funs = [
+ BuiltinScalarFunction::Concat,
+ BuiltinScalarFunction::ToTimestamp,
+ BuiltinScalarFunction::Abs,
+ BuiltinScalarFunction::Repeat,
+ ];
Review comment:
In such cases I think it helps to put a comment with the rationale for
why those were picked so future readers don't wonder if there is anything
special
so something like
```rust
// pick some arbitrary functions to test
```
##########
File path: datafusion/src/physical_plan/functions.rs
##########
@@ -3859,28 +3861,56 @@ mod tests {
}
#[test]
- fn test_concat_error() -> Result<()> {
+ fn test_empty_arguments_error() -> Result<()> {
let ctx_state = ExecutionContextState::new();
let schema = Schema::new(vec![Field::new("a", DataType::Int32,
false)]);
- let expr = create_physical_expr(
- &BuiltinScalarFunction::Concat,
- &[],
- &schema,
- &ctx_state,
- )?;
+ let funs = [
+ BuiltinScalarFunction::Concat,
+ BuiltinScalarFunction::ToTimestamp,
+ BuiltinScalarFunction::Abs,
+ BuiltinScalarFunction::Repeat,
+ ];
+
+ for fun in funs.iter() {
+ let expr = create_physical_expr(fun, &[], &schema, &ctx_state);
+
+ match expr {
Review comment:
You can often combine the patterns in a single `match` statement,
something like this:
```rust
match expr {
Ok(..) => ...,
Err(DataFusionError::Internal(err)) => ...,
Err(_) => ...
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]