Skip to content

Remove LargeUtf8|Binary, Utf8|BinaryView, and Dictionary from ScalarValue #11978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub mod file_options;
pub mod format;
pub mod hash_utils;
pub mod instant;
pub mod logical;
pub mod parsers;
pub mod rounding;
pub mod scalar;
Expand Down
26 changes: 26 additions & 0 deletions datafusion/common/src/logical/eq.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use arrow_schema::DataType;

pub trait LogicallyEq<Rhs: ?Sized = Self> {
#[must_use]
fn logically_eq(&self, other: &Rhs) -> bool;
}

impl LogicallyEq for DataType {
fn logically_eq(&self, other: &Self) -> bool {
use DataType::*;

match (self, other) {
(Utf8 | LargeUtf8 | Utf8View, Utf8 | LargeUtf8 | Utf8View)
| (Binary | LargeBinary | BinaryView, Binary | LargeBinary | BinaryView) => {
true
}
(Dictionary(_, inner), other) | (other, Dictionary(_, inner)) => {
other.logically_eq(inner)
}
(RunEndEncoded(_, inner), other) | (other, RunEndEncoded(_, inner)) => {
other.logically_eq(inner.data_type())
}
_ => self == other,
}
}
}
1 change: 1 addition & 0 deletions datafusion/common/src/logical/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod eq;
439 changes: 70 additions & 369 deletions datafusion/common/src/scalar/mod.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions datafusion/common/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ pub fn array_into_list_array(arr: ArrayRef, nullable: bool) -> ListArray {

/// Wrap an array into a single element `LargeListArray`.
/// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
pub fn array_into_large_list_array(arr: ArrayRef) -> LargeListArray {
pub fn array_into_large_list_array(arr: ArrayRef, nullable: bool) -> LargeListArray {
let offsets = OffsetBuffer::from_lengths([arr.len()]);
LargeListArray::new(
Arc::new(Field::new_list_field(arr.data_type().to_owned(), true)),
Arc::new(Field::new_list_field(arr.data_type().to_owned(), nullable)),
offsets,
arr,
None,
Expand Down
Loading
Loading