Skip to content

Apache DataFusion SQL Query Engine

fix(spark): return error from ELT coerce_types when fewer than 2 args (#23164)

David Lópeza59c4f56abae
diff --git a/datafusion/spark/src/function/string/elt.rs b/datafusion/spark/src/function/string/elt.rs
index c37ecd1d3f..e58faf0c40 100644
--- a/datafusion/spark/src/function/string/elt.rs
+++ b/datafusion/spark/src/function/string/elt.rs
@@ -69,9 +69,9 @@ impl ScalarUDFImpl for SparkElt {
fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
let length = arg_types.len();
if length < 2 {
- plan_datafusion_err!(
+ return Err(plan_datafusion_err!(
"ELT function expects at least 2 arguments: index, value1"
- );
+ ));
}
let idx_dt: &DataType = &arg_types[0];