We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7bc6214 commit 0f4360bCopy full SHA for 0f4360b
crates/polars-plan/src/plans/functions/rename.rs
@@ -5,10 +5,18 @@ pub(super) fn rename_impl(
5
existing: &[PlSmallStr],
6
new: &[PlSmallStr],
7
) -> PolarsResult<DataFrame> {
8
- let positions = existing
9
- .iter()
10
- .map(|old| df.get_column_index(old))
11
- .collect::<Vec<_>>();
+ let positions = if existing.len() > 1 && df.get_columns().len() > 10 {
+ let schema = df.schema();
+ existing
+ .iter()
12
+ .map(|old| schema.get_full(old).map(|(idx, _, _)| idx))
13
+ .collect::<Vec<_>>()
14
+ } else {
15
16
17
+ .map(|old| df.get_column_index(old))
18
19
+ };
20
21
for (pos, name) in positions.iter().zip(new.iter()) {
22
// the column might be removed due to projection pushdown
0 commit comments