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

Code before:
                    f | FunctionFlags::NON_ORDER_OBSERVING | FunctionFlags::TERMINATES_INPUT_ORDER
                } else {
                    f
                }
            }),
            #[cfg(feature = "moment")]
            F::Skew(_) => FunctionOptions::aggregation().flag(FunctionFlags::NON_ORDER_OBSERVING),
            #[cfg(feature = "moment")]
            F::Kurtosis(_, _) => {
                FunctionOptions::aggregation().flag(FunctionFlags::NON_ORDER_OBSERVING)
            },
            #[cfg(feature = "dtype-array")]
            F::Reshape(dims) => {
                if dims.len() == 1 && dims[0] == ReshapeDimension::Infer {
                    FunctionOptions::row_separable()
                } else {
                    FunctionOptions::groupwise()
                }
            },
            #[cfg(feature = "repeat_by")]
            F::RepeatBy => FunctionOptions::elementwise(),
            F::ArgUnique => FunctionOptions::groupwise(),
            F::ArgMin | F::ArgMax => FunctionOptions::aggregation(),
            F::ArgSort { .. } => FunctionOptions::length_preserving(),
            F::MinBy | F::MaxBy => FunctionOptions::aggregation(),
            // TODO: decimal product is order-observing, we should get schema here to determine.
            F::Product => FunctionOptions::aggregation(),
            #[cfg(feature = "rank")]
            F::Rank { .. } => FunctionOptions::length_preserving(),
            F::Repeat => {
                FunctionOptions::groupwise().with_flags(|f| f | FunctionFlags::ALLOW_RENAME)
            },
            #[cfg(feature = "round_series")]
            F::Clip { .. } => FunctionOptions::elementwise(),
            #[cfg(feature = "dtype-struct")]
            F::AsStruct => FunctionOptions::elementwise().with_flags(|f| {
                f | FunctionFlags::PASS_NAME_TO_APPLY | FunctionFlags::INPUT_WILDCARD_EXPANSION
            }),
            #[cfg(feature = "top_k")]
            F::TopK { .. } => FunctionOptions::groupwise(),
            #[cfg(feature = "top_k")]
            F::TopKBy { .. } => FunctionOptions::groupwise(),
            #[cfg(feature = "cum_agg")]
            F::CumCount { .. }
            | F::CumSum { .. }
            | F::CumProd { .. }
            | F::CumMin { .. }
            | F::CumMax { .. } => FunctionOptions::length_preserving(),
            F::Reverse => FunctionOptions::length_preserving()
                .with_flags(|f| f | FunctionFlags::NON_ORDER_OBSERVING),
            #[cfg(feature = "dtype-struct")]

Review comment (suggestion):
```suggestion
            // TODO: Only decimal product is order-observing, we should get schema here to indicate `NON_ORDER_OBSERVING` for other dtypes
```

Code after:
                    f | FunctionFlags::NON_ORDER_OBSERVING | FunctionFlags::TERMINATES_INPUT_ORDER
                } else {
                    f
                }
            }),
            #[cfg(feature = "moment")]
            F::Skew(_) => FunctionOptions::aggregation().flag(FunctionFlags::NON_ORDER_OBSERVING),
            #[cfg(feature = "moment")]
            F::Kurtosis(_, _) => {
                FunctionOptions::aggregation().flag(FunctionFlags::NON_ORDER_OBSERVING)
            },
            #[cfg(feature = "dtype-array")]
            F::Reshape(dims) => {
                if dims.len() == 1 && dims[0] == ReshapeDimension::Infer {
                    FunctionOptions::row_separable()
                } else {
                    FunctionOptions::groupwise()
                }
            },
            #[cfg(feature = "repeat_by")]
            F::RepeatBy => FunctionOptions::elementwise(),
            F::ArgUnique => FunctionOptions::groupwise(),
            F::ArgMin | F::ArgMax => FunctionOptions::aggregation(),
            F::ArgSort { .. } => FunctionOptions::length_preserving(),
            F::MinBy | F::MaxBy => FunctionOptions::aggregation(),
            // TODO: Only decimal product is order-observing, we should get schema here to indicate `NON_ORDER_OBSERVING` for other dtypes.
            F::Product => FunctionOptions::aggregation(),
            #[cfg(feature = "rank")]
            F::Rank { .. } => FunctionOptions::length_preserving(),
            F::Repeat => {
                FunctionOptions::groupwise().with_flags(|f| f | FunctionFlags::ALLOW_RENAME)
            },
            #[cfg(feature = "round_series")]
            F::Clip { .. } => FunctionOptions::elementwise(),
            #[cfg(feature = "dtype-struct")]
            F::AsStruct => FunctionOptions::elementwise().with_flags(|f| {
                f | FunctionFlags::PASS_NAME_TO_APPLY | FunctionFlags::INPUT_WILDCARD_EXPANSION
            }),
            #[cfg(feature = "top_k")]
            F::TopK { .. } => FunctionOptions::groupwise(),
            #[cfg(feature = "top_k")]
            F::TopKBy { .. } => FunctionOptions::groupwise(),
            #[cfg(feature = "cum_agg")]
            F::CumCount { .. }
            | F::CumSum { .. }
            | F::CumProd { .. }
            | F::CumMin { .. }
            | F::CumMax { .. } => FunctionOptions::length_preserving(),
            F::Reverse => FunctionOptions::length_preserving()
                .with_flags(|f| f | FunctionFlags::NON_ORDER_OBSERVING),
            #[cfg(feature = "dtype-struct")]