MCPcopy Create free account
hub / github.com/apache/datafusion / try_as_col

Method try_as_col

datafusion/expr/src/expr.rs:2021–2027  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 6

try_into_logical_planMethod · 0.80
infer_join_predicatesFunction · 0.80
rewriteMethod · 0.80
f_upMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected