Closed
Description
As is, the example below can be a necessary evil. Using separate, concrete structs allows the data to be passed as a single value.
fn main() {
// ...
match sql_ast {
SQLSelect { projection, relation, joins, selection,
order_by, group_by, having, limit } => {
select(projection, relation, joins, selection,
order_by, group_by, having, limit, &mut out_ts);
},
_ => {}
}
}
fn select(projection: Vec<ASTNode>, relation: Option<Box<ASTNode>>, joins: Vec<Join>,
selection: Option<Box<ASTNode>>, order_by: Option<Vec<SQLOrderByExpr>>,
group_by: Option<Vec<ASTNode>>, having: Option<Box<ASTNode>>, limit: Option<Box<ASTNode>>,
out_ts: &mut TokenStream) {
// ...
}
Activity
nickolay commentedon Jan 30, 2019
FWIW, I did this to
SQLSelect
locally in an experiment to make the AST more strongly typed, because it lets me to use the struct both from an ASTNode (for a subquery) and from an SQLStatement (as a top-level statement).nickolay commentedon May 7, 2019
The branch I mentioned above has been merged, so SQLSelect / SQLQuery are separate structs now. Some ASTNode variants are still inlined though, but I'm not sure it makes sense to mechanically create a separate struct for each variant. Are there any variants where this is still a problem?
listagg
support? #169alamb commentedon Dec 12, 2021
Closing as a dupe of #311 as suggested in #311 (comment)