Skip to content

Commit

Permalink
fix return type (#9357)
Browse files Browse the repository at this point in the history
  • Loading branch information
guojidan authored Feb 27, 2024
1 parent ea30b93 commit 544b3d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions datafusion/functions/src/core/nvl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ impl ScalarUDFImpl for NVLFunc {
}

fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
// NVL has two args and they might get coerced, get a preview of this
let coerced_types = datafusion_expr::type_coercion::functions::data_types(arg_types, &self.signature);
coerced_types.map(|typs| typs[0].clone())
.map_err(|e| e.context("Failed to coerce arguments for NVL")
)
Ok(arg_types[0].clone())
}

fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/nvl.slt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ SELECT NVL(1, 3);
----
1

query I
query ?
SELECT NVL(NULL, NULL);
----
NULL

0 comments on commit 544b3d9

Please sign in to comment.