Repository: pola-rs/polars
File: crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs (Rust)

Code before:
                let mut subset_colnames = vec![];
                let mut subset_exprs = vec![];
                for expr in &exprs {
                    match expr {
                        Expr::Column(name) => {
                            polars_ensure!(
                                input_schema.contains(name),
                                ColumnNotFound: "{name:?} not found"
                            );
                            subset_colnames.push(name.clone());
                        },
                        _ => subset_exprs.push(expr.clone()),
                    }
                }

                if subset_exprs.is_empty() {
                    // "subset" is a collection of basic cols (or empty)
                    (input, Some(subset_colnames.into_iter().collect()), vec![])
                } else {
                    // "subset" contains exprs; add them as temporary cols
                    let (aliased_exprs, temp_names): (Vec<_>, Vec<_>) = subset_exprs
                        .into_iter()
                        .enumerate()
                        .map(|(idx, expr)| {
                            let temp_name =
                                PlSmallStr::from_string(format!("__POLARS_UNIQUE_SUBSET_{}", idx));
                            (expr.alias(temp_name.clone()), temp_name)
                        })
                        .unzip();

                    subset_colnames.extend_from_slice(&temp_names);

                    // integrate the temporary cols with the existing "input" node
                    let (temp_expr_irs, schema) = resolve_with_columns(
                        aliased_exprs,
                        input,
                        ctxt.lp_arena,
                        ctxt.expr_arena,
                        ctxt.opt_flags,
                    )?;
                    ctxt.conversion_optimizer
                        .fill_scratch(&temp_expr_irs, ctxt.expr_arena);

                    let input_with_exprs = ctxt.lp_arena.add(IR::HStack {
                        input,
                        exprs: temp_expr_irs,
                        schema,
                        options: ProjectionOptions {
                            run_parallel: false,
                            duplicate_check: false,
                            should_broadcast: true,

Review comment (suggestion):
```suggestion
                                format_pl_smallstr!("__POLARS_UNIQUE_SUBSET_{}", idx);
```

Code after:
                let mut subset_exprs = vec![];
                for expr in &exprs {
                    match expr {
                        Expr::Column(name) => {
                            polars_ensure!(
                                input_schema.contains(name),
                                ColumnNotFound: "{name:?} not found"
                            );
                            subset_colnames.push(name.clone());
                        },
                        _ => subset_exprs.push(expr.clone()),
                    }
                }

                if subset_exprs.is_empty() {
                    // "subset" is a collection of basic cols (or empty)
                    (input, Some(subset_colnames.into_iter().collect()), vec![])
                } else {
                    // "subset" contains exprs; add them as temporary cols
                    let (aliased_exprs, temp_names): (Vec<_>, Vec<_>) = subset_exprs
                        .into_iter()
                        .enumerate()
                        .map(|(idx, expr)| {
                            let temp_name = format_pl_smallstr!("__POLARS_UNIQUE_SUBSET_{}", idx);
                            (expr.alias(temp_name.clone()), temp_name)
                        })
                        .unzip();

                    subset_colnames.extend_from_slice(&temp_names);

                    // integrate the temporary cols with the existing "input" node
                    let (temp_expr_irs, schema) = resolve_with_columns(
                        aliased_exprs,
                        input,
                        ctxt.lp_arena,
                        ctxt.expr_arena,
                        ctxt.opt_flags,
                    )?;
                    ctxt.conversion_optimizer
                        .fill_scratch(&temp_expr_irs, ctxt.expr_arena);

                    let input_with_exprs = ctxt.lp_arena.add(IR::HStack {
                        input,
                        exprs: temp_expr_irs,
                        schema,
                        options: ProjectionOptions {
                            run_parallel: false,
                            duplicate_check: false,
                            should_broadcast: true,
                        },
                    });