Find qualified columns for this dataframe from names # Arguments `names` - Unqualified names to find. # Example ``` # use datafusion::prelude::*; # use datafusion::error::Result; # use datafusion_common::ScalarValue; # #[tokio::main] # async fn main() -> Result<()> { let ctx = SessionContext::new(); ctx.register_csv("first_table", "tests/data/example.csv", CsvReadOptions::new()) .await?; let df
(
&self,
names: &[&str],
)
| 2536 | /// # } |
| 2537 | /// ``` |
| 2538 | pub fn find_qualified_columns( |
| 2539 | &self, |
| 2540 | names: &[&str], |
| 2541 | ) -> Result<Vec<(Option<&TableReference>, &FieldRef)>> { |
| 2542 | let schema = self.logical_plan().schema(); |
| 2543 | names |
| 2544 | .iter() |
| 2545 | .map(|name| { |
| 2546 | schema |
| 2547 | .qualified_field_from_column(&Column::from_name(*name)) |
| 2548 | .map_err(|_| plan_datafusion_err!("Column '{}' not found", name)) |
| 2549 | }) |
| 2550 | .collect() |
| 2551 | } |
| 2552 | |
| 2553 | /// Helper for creating DataFrame. |
| 2554 | /// # Example |