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

Method unnest_to_sql

datafusion/sql/src/unparser/expr.rs:1772–1793  ·  view source on GitHub ↗

Converts an UNNEST operation to an AST expression by wrapping it as a function call, since there is no direct representation for UNNEST in the AST.

(&self, unnest: &Unnest)

Source from the content-addressed store, hash-verified

1770 /// Converts an UNNEST operation to an AST expression by wrapping it as a function call,
1771 /// since there is no direct representation for UNNEST in the AST.
1772 fn unnest_to_sql(&self, unnest: &Unnest) -> Result<ast::Expr> {
1773 let args = self.function_args_to_sql(std::slice::from_ref(&unnest.expr))?;
1774
1775 Ok(ast::Expr::Function(Function {
1776 name: ObjectName::from(vec![Ident {
1777 value: "UNNEST".to_string(),
1778 quote_style: None,
1779 span: Span::empty(),
1780 }]),
1781 args: ast::FunctionArguments::List(ast::FunctionArgumentList {
1782 duplicate_treatment: None,
1783 args,
1784 clauses: vec![],
1785 }),
1786 filter: None,
1787 null_treatment: None,
1788 over: None,
1789 within_group: vec![],
1790 parameters: ast::FunctionArguments::None,
1791 uses_odbc_syntax: false,
1792 }))
1793 }
1794
1795 fn arrow_dtype_to_ast_dtype(&self, field: &FieldRef) -> Result<ast::DataType> {
1796 let data_type = field.data_type();

Callers 1

expr_to_sql_innerMethod · 0.80

Calls 3

FunctionEnum · 0.85
function_args_to_sqlMethod · 0.80
ListClass · 0.50

Tested by

no test coverage detected