Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrishn7 committed Feb 7, 2025
1 parent 2274b6b commit 83a43d5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2745,21 +2745,19 @@ impl Union {
inputs: &[Arc<LogicalPlan>],
loose_types: bool,
) -> Result<DFSchemaRef> {
type FieldData<'a> = (&'a DataType, bool, Vec<&'a HashMap<String, String>>);
// Prefer `BTreeMap` as it produces items in order by key when iterated over
let mut cols: BTreeMap<&str, (&DataType, bool, Vec<&HashMap<String, String>>)> =
BTreeMap::new();
let mut cols: BTreeMap<&str, FieldData> = BTreeMap::new();
for input in inputs.iter() {
for field in input.schema().fields() {
match cols.entry(&field.name()) {
match cols.entry(field.name()) {
std::collections::btree_map::Entry::Occupied(mut occupied) => {
let (data_type, is_nullable, metadata) = occupied.get_mut();
if !loose_types {
if *data_type != field.data_type() {
return plan_err!(
"Found different types for field {}",
field.name()
);
}
if !loose_types && *data_type != field.data_type() {
return plan_err!(
"Found different types for field {}",
field.name()
);
}

metadata.push(field.metadata());
Expand Down

0 comments on commit 83a43d5

Please sign in to comment.