-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
arrowChanges to the arrow crateChanges to the arrow cratebuggood first issueGood for newcomersGood for newcomershelp wanted
Description
Describe the bug
When using the arith kernel's is_null or is_not_null on arrays of type NullArray (with datatype Null) the .nulls() buffer is always empty for these types. Therefor the kernel returns an array with all values false/true which is the exact opposite of what should be returned.
To Reproduce
Noticed it here apache/datafusion#7038
Run this unit test in datafusion/is_null.rs
fn is_null_op_allnull() -> Result<()> {
let schema = Schema::new(vec![Field::new("a", DataType::Null, true)]);
let mut a = NullBuilder::with_capacity(1);
// expression: "a is null"
let expr = is_null(col("a", &schema)?).unwrap();
let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(a.finish())])?;
let result = expr.evaluate(&batch)?.into_array(batch.num_rows());
let result =
as_boolean_array(&result).expect("failed to downcast to BooleanArray");
let expected = &BooleanArray::from(vec![true]);
assert_eq!(expected, result);
Ok(())
}
Expected behavior
for is_null I expect a BoolArray of true values for NullArray input (irrespective of length).
for is_not_null I expect a BoolArray of false values for NullArray input (irrespective of length).
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arrowChanges to the arrow crateChanges to the arrow cratebuggood first issueGood for newcomersGood for newcomershelp wanted