yonatan-sevenai commented on code in PR #21593:
URL: https://github.com/apache/datafusion/pull/21593#discussion_r3114241854


##########
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:
   Fixed. This also uncovered another small issue which was fixed as well.
   



-- 
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]

Reply via email to