Skip to content

Commit

Permalink
Re-enable concat test
Browse files Browse the repository at this point in the history
  • Loading branch information
msathis committed May 14, 2021
1 parent 930aaae commit 1987ac3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion datafusion/src/optimizer/constant_folding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ mod tests {
) -> String {
let rule = ConstantFolding::new();
let execution_props = ExecutionProps {
query_execution_start_time: Some(date_time.clone()),
query_execution_start_time: Some(*date_time),
};

let optimized_plan = rule
Expand Down
37 changes: 24 additions & 13 deletions datafusion/src/physical_plan/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3625,19 +3625,30 @@ mod tests {
Ok(())
}

// #[test]
// fn test_concat_error() -> Result<()> {
// let result = return_type(&BuiltinScalarFunction::Concat, &[]);
//
// if result.is_ok() {
// println!("{}", result.unwrap());
// Err(DataFusionError::Plan(
// "Function 'concat' cannot accept zero arguments".to_string(),
// ))
// } else {
// Ok(())
// }
// }
#[test]
fn test_concat_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 columns: Vec<ArrayRef> = vec![Arc::new(Int32Array::from(vec![1]))];
let batch = RecordBatch::try_new(Arc::new(schema.clone()), columns)?;
let result = expr.evaluate(&batch);

if result.is_ok() {
Err(DataFusionError::Plan(
"Function 'concat' cannot accept zero arguments".to_string(),
))
} else {
Ok(())
}
}

fn generic_test_array(
value1: ArrayRef,
Expand Down

0 comments on commit 1987ac3

Please sign in to comment.