Path: blob/main/crates/polars-plan/src/plans/aexpr/function_expr/pow.rs
7889 views
use std::fmt;12use super::IRFunctionExpr;3use crate::prelude::FunctionOptions;45#[cfg_attr(feature = "ir_serde", derive(serde::Serialize, serde::Deserialize))]6#[derive(Clone, Copy, PartialEq, Debug, Eq, Hash)]7pub enum IRPowFunction {8Generic,9Sqrt,10Cbrt,11}1213impl IRPowFunction {14pub fn function_options(&self) -> FunctionOptions {15use IRPowFunction as P;16match self {17P::Generic | P::Sqrt | P::Cbrt => FunctionOptions::elementwise(),18}19}20}2122impl fmt::Display for IRPowFunction {23fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {24use self::*;25match self {26IRPowFunction::Generic => write!(f, "pow"),27IRPowFunction::Sqrt => write!(f, "sqrt"),28IRPowFunction::Cbrt => write!(f, "cbrt"),29}30}31}3233impl From<IRPowFunction> for IRFunctionExpr {34fn from(value: IRPowFunction) -> Self {35Self::Pow(value)36}37}383940