Skip to content
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

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 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
43 changes: 43 additions & 0 deletions datafusion/common/src/logical/eq.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

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)) => {
notfilippo marked this conversation as resolved.
Show resolved Hide resolved
other.logically_eq(inner)
}
(RunEndEncoded(_, inner), other) | (other, RunEndEncoded(_, inner)) => {
other.logically_eq(inner.data_type())
}
_ => self == other,
}
}
}
18 changes: 18 additions & 0 deletions datafusion/common/src/logical/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

pub mod eq;
notfilippo marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading