goldmedal commented on code in PR #21593:
URL: https://github.com/apache/datafusion/pull/21593#discussion_r3114736414
##########
datafusion/sql/src/unparser/ast.rs:
##########
@@ -162,9 +162,28 @@ pub struct SelectBuilder {
qualify: Option<ast::Expr>,
value_table_mode: Option<ast::ValueTableMode>,
flavor: Option<SelectFlavor>,
+ /// Counter for generating unique LATERAL FLATTEN aliases within this
SELECT.
+ flatten_alias_counter: usize,
}
impl SelectBuilder {
+ /// Generate a unique alias for a LATERAL FLATTEN relation
+ /// (`_unnest_1`, `_unnest_2`, …). Each call returns a fresh name.
+ pub fn next_flatten_alias(&mut self) -> String {
+ self.flatten_alias_counter += 1;
+ format!("_unnest_{}", self.flatten_alias_counter)
Review Comment:
@yonatan-sevenai The test case for the multiple unnest is still missing.
Could you add it? I expect something like the following to trigger the alias
counter.
```sql
SELECT * FROM j1, UNNEST(extract_array(j1_string)), j2,
UNNEST(extract_array(j2_string)) LIMIT 5
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]