EnxDev commented on code in PR #45739:
URL: https://github.com/apache/superset/pull/45739#discussion_r4402485255


##########
superset/models/helpers.py:
##########
@@ -2492,7 +2499,15 @@ def expression_text(element: ColumnElement) -> str | 
None:
                 unquoted = re.sub(f"[{quotes}]", "", expression)
                 reads_it = re.search(rf"(?<![\w.]){re.escape(name)}(?!\w)", 
unquoted)
                 if name in column_names or reads_it:
-                    col.name = f"{name}__"
+                    col.name = self._unused_alias(name, taken)
+
+    @staticmethod
+    def _unused_alias(name: str, taken: set[str]) -> str:

Review Comment:
   Nit, take it or leave it. New helpers are supposed to carry a docstring 
here, and a one-liner would also say why the loop exists:
   
   ```suggestion
       def _unused_alias(name: str, taken: set[str]) -> str:
           """Return the first free `name__`, `name___`, ... alias and reserve 
it."""
   ```



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