Skip to content

Commit d7a886c

Browse files
authored
fix return field for is_null and is_not_null expression (#17056)
1 parent a9e6d4b commit d7a886c

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

datafusion/physical-expr/src/expressions/is_not_null.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
//! IS NOT NULL expression
1919
2020
use crate::PhysicalExpr;
21-
use arrow::datatypes::FieldRef;
2221
use arrow::{
2322
datatypes::{DataType, Schema},
2423
record_batch::RecordBatch,
@@ -94,10 +93,6 @@ impl PhysicalExpr for IsNotNullExpr {
9493
}
9594
}
9695

97-
fn return_field(&self, input_schema: &Schema) -> Result<FieldRef> {
98-
self.arg.return_field(input_schema)
99-
}
100-
10196
fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>> {
10297
vec![&self.arg]
10398
}

datafusion/physical-expr/src/expressions/is_null.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
//! IS NULL expression
1919
2020
use crate::PhysicalExpr;
21-
use arrow::datatypes::FieldRef;
2221
use arrow::{
2322
datatypes::{DataType, Schema},
2423
record_batch::RecordBatch,
@@ -93,10 +92,6 @@ impl PhysicalExpr for IsNullExpr {
9392
}
9493
}
9594

96-
fn return_field(&self, input_schema: &Schema) -> Result<FieldRef> {
97-
self.arg.return_field(input_schema)
98-
}
99-
10095
fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>> {
10196
vec![&self.arg]
10297
}

datafusion/sqllogictest/test_files/expr.slt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,3 +2131,26 @@ query T
21312131
select E'foo\t\tbar';
21322132
----
21332133
foo bar
2134+
2135+
statement ok
2136+
create table t (a float) as values (1), (null), (3);
2137+
2138+
# https://github.com/apache/datafusion/issues/17055
2139+
# is not null did not correctly infer as boolean in udf argument position
2140+
query B
2141+
select greatest(a is not null, false) from t;
2142+
----
2143+
true
2144+
false
2145+
true
2146+
2147+
# same for is null
2148+
query B
2149+
select greatest(a is null, false) from t;
2150+
----
2151+
false
2152+
true
2153+
false
2154+
2155+
statement ok
2156+
drop table t;

0 commit comments

Comments
 (0)