Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordworms committed Feb 12, 2024
1 parent cdb44e3 commit 6f83520
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ pub fn change_redundant_column(fields: Vec<DFField>) -> Vec<DFField> {
let counter = name_map.entry(field.name().to_string()).or_insert(0);
*counter += 1;
if *counter > 1 {
let new_name = format!("{}:{}", field.name(), counter);
let new_name = format!("{}:{}", field.name(), *counter - 1);
DFField::new(
field.qualifier().cloned(),
&new_name,
Expand Down Expand Up @@ -2115,9 +2115,9 @@ mod tests {
remove_redundant,
vec![
DFField::new_unqualified("a", DataType::Int32, false),
DFField::new_unqualified("a:0", DataType::Int32, false),
DFField::new_unqualified("a:1", DataType::Int32, false),
DFField::new_unqualified("b", DataType::Int32, false),
DFField::new_unqualified("b:0", DataType::Int32, false)
DFField::new_unqualified("b:1", DataType::Int32, false)
]
);
Ok(())
Expand Down

0 comments on commit 6f83520

Please sign in to comment.