Repository: pola-rs/polars
File: crates/polars-plan/src/plans/functions/dsl.rs (Rust)

Code before:
            #[cfg(feature = "pivot")]
            DslFunction::Unpivot { args } => {
                let on = args.on.into_columns(input_schema, &Default::default())?;
                let index = args.index.into_columns(input_schema, &Default::default())?;

                let args = UnpivotArgsIR {
                    on: on.into_iter().collect(),
                    index: index.into_iter().collect(),
                    variable_name: args.variable_name.clone(),
                    value_name: args.value_name,
                };

                FunctionIR::Unpivot {
                    args: Arc::new(args),
                    schema: Default::default(),
                }
            },
            DslFunction::FunctionIR(func) => func,
            DslFunction::RowIndex { name, offset } => FunctionIR::RowIndex {
                name,
                offset,
                schema: Default::default(),
            },
            DslFunction::Unnest(selector) => {
                let columns = selector.into_columns(input_schema, &Default::default())?;
                let columns = columns.into_iter().collect();
                for col in Arc::clone(&columns).iter() {
                    let dtype = input_schema.try_get(col.as_str())?;
                    polars_ensure!(
                        dtype.is_struct(),
                        InvalidOperation: "invalid dtype: expected 'Struct', got '{:?}' for '{}'", dtype, col
                    );
                }
                FunctionIR::Unnest { columns }
            },
            #[cfg(feature = "python")]
            DslFunction::OpaquePython(inner) => FunctionIR::OpaquePython(inner),
            DslFunction::Stats(_)
            | DslFunction::FillNan(_)
            | DslFunction::Rename { .. }
            | DslFunction::Explode { .. } => {
                // We should not reach this.
                panic!("impl error")
            },
        };
        Ok(function)
    }
}

impl Debug for DslFunction {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {

Review comment (suggestion):
```suggestion
                let columns: Arc<[PlSmallStr]> = columns.into_iter().collect();
```


Code after:
            #[cfg(feature = "pivot")]
            DslFunction::Unpivot { args } => {
                let on = args.on.into_columns(input_schema, &Default::default())?;
                let index = args.index.into_columns(input_schema, &Default::default())?;

                let args = UnpivotArgsIR {
                    on: on.into_iter().collect(),
                    index: index.into_iter().collect(),
                    variable_name: args.variable_name.clone(),
                    value_name: args.value_name,
                };

                FunctionIR::Unpivot {
                    args: Arc::new(args),
                    schema: Default::default(),
                }
            },
            DslFunction::FunctionIR(func) => func,
            DslFunction::RowIndex { name, offset } => FunctionIR::RowIndex {
                name,
                offset,
                schema: Default::default(),
            },
            DslFunction::Unnest(selector) => {
                let columns = selector.into_columns(input_schema, &Default::default())?;
                let columns: Arc<[PlSmallStr]> = columns.into_iter().collect();
                for col in columns.iter() {
                    let dtype = input_schema.try_get(col.as_str())?;
                    polars_ensure!(
                        dtype.is_struct(),
                        InvalidOperation: "invalid dtype: expected 'Struct', got '{:?}' for '{}'", dtype, col
                    );
                }
                FunctionIR::Unnest { columns }
            },
            #[cfg(feature = "python")]
            DslFunction::OpaquePython(inner) => FunctionIR::OpaquePython(inner),
            DslFunction::Stats(_)
            | DslFunction::FillNan(_)
            | DslFunction::Rename { .. }
            | DslFunction::Explode { .. } => {
                // We should not reach this.
                panic!("impl error")
            },
        };
        Ok(function)
    }
}

impl Debug for DslFunction {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {