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

Method col_to_sql

datafusion/sql/src/unparser/expr.rs:844–869  ·  view source on GitHub ↗
(&self, col: &Column)

Source from the content-addressed store, hash-verified

842 }
843
844 pub fn col_to_sql(&self, col: &Column) -> Result<ast::Expr> {
845 // Replace the column name if the dialect has an override
846 let col_name =
847 if let Some(rewritten_name) = self.dialect.col_alias_overrides(&col.name)? {
848 rewritten_name
849 } else {
850 col.name.to_string()
851 };
852
853 if let Some(table_ref) = &col.relation {
854 let mut id = if self.dialect.full_qualified_col() {
855 table_ref.to_vec()
856 } else {
857 vec![table_ref.table().to_string()]
858 };
859 id.push(col_name);
860 return Ok(ast::Expr::CompoundIdentifier(
861 id.iter()
862 .map(|i| self.new_ident_quoted_if_needs(i.to_string()))
863 .collect(),
864 ));
865 }
866 Ok(ast::Expr::Identifier(
867 self.new_ident_quoted_if_needs(col_name),
868 ))
869 }
870
871 fn convert_bound(
872 &self,

Callers 3

expr_to_sql_innerMethod · 0.80
get_field_to_sqlMethod · 0.80

Calls 10

IdentifierClass · 0.85
to_vecMethod · 0.80
collectMethod · 0.80
col_alias_overridesMethod · 0.45
to_stringMethod · 0.45
full_qualified_colMethod · 0.45
pushMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected