Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datafusion/common/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3588,7 +3588,7 @@ impl ScalarValue {
/// Converts a value in `array` at `index` into a ScalarValue
pub fn try_from_array(array: &dyn Array, index: usize) -> Result<Self> {
// handle NULL value
if !array.is_valid(index) {
if array.is_null(index) {
return array.data_type().try_into();
}

Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr-common/src/binary_view_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ where
let hash = self.hashes_buffer[i];

// handle null value via validity bitmap check
if !values.is_valid(i) {
if values.is_null(i) {
let payload = if let Some(&(payload, _offset)) = self.null.as_ref() {
payload
} else {
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr-common/src/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ pub fn compare_op_for_nested(
(false, false) | (true, true) => NullBuffer::union(l.nulls(), r.nulls()),
(true, false) => {
// When left is null-scalar and right is array, expand left nulls to match result length
match l.nulls().filter(|nulls| !nulls.is_valid(0)) {
match l.nulls().filter(|nulls| nulls.is_null(0)) {
Some(_) => Some(NullBuffer::new_null(len)), // Left scalar is null
None => r.nulls().cloned(), // Left scalar is non-null
}
}
(false, true) => {
// When right is null-scalar and left is array, expand right nulls to match result length
match r.nulls().filter(|nulls| !nulls.is_valid(0)) {
match r.nulls().filter(|nulls| nulls.is_null(0)) {
Some(_) => Some(NullBuffer::new_null(len)), // Right scalar is null
None => l.nulls().cloned(), // Right scalar is non-null
}
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/expressions/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ mod tests {
for (i, x) in $VEC.iter().enumerate() {
match x {
Some(x) => assert_eq!(result.value(i), *x),
None => assert!(!result.is_valid(i)),
None => assert!(result.is_null(i)),
}
}
}};
Expand Down Expand Up @@ -388,7 +388,7 @@ mod tests {
for (i, x) in $VEC.iter().enumerate() {
match x {
Some(x) => assert_eq!(result.value(i), *x),
None => assert!(!result.is_valid(i)),
None => assert!(result.is_null(i)),
}
}
}};
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/expressions/try_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ mod tests {
for (i, x) in $VEC.iter().enumerate() {
match x {
Some(x) => assert_eq!(result.value(i), *x),
None => assert!(!result.is_valid(i)),
None => assert!(result.is_null(i)),
}
}
}};
Expand Down Expand Up @@ -260,7 +260,7 @@ mod tests {
for (i, x) in $VEC.iter().enumerate() {
match x {
Some(x) => assert_eq!(result.value(i), *x),
None => assert!(!result.is_valid(i)),
None => assert!(result.is_null(i)),
}
}
}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ macro_rules! get_row_value {
///
/// Floating numbers are rounded to have a consistent representation with the Postgres runner.
pub fn cell_to_string(col: &ArrayRef, row: usize, is_spark_path: bool) -> Result<String> {
if !col.is_valid(row) {
if col.is_null(row) {
// represent any null value with the string "NULL"
Ok(NULL_STR.to_string())
} else {
Expand Down