Return a reference to the inner `Column` if any returns `None` if the expression is not a `Column` Note: None may be returned for expressions that are not `Column` but are convertible to `Column` such as `Cast` expressions. Example ``` # use datafusion_common::Column; use datafusion_expr::{col, Expr}; let expr = col("foo"); assert_eq!(expr.try_as_col(), Some(&Column::from("foo"))); let expr =
(&self)
| 2019 | /// assert_eq!(expr.try_as_col(), None); |
| 2020 | /// ``` |
| 2021 | pub fn try_as_col(&self) -> Option<&Column> { |
| 2022 | if let Expr::Column(it) = self { |
| 2023 | Some(it) |
| 2024 | } else { |
| 2025 | None |
| 2026 | } |
| 2027 | } |
| 2028 | |
| 2029 | /// Returns the inner `Column` if any. This is a specialized version of |
| 2030 | /// [`Self::try_as_col`] that take Cast expressions into account when the |
no outgoing calls
no test coverage detected