michael-s-molina commented on code in PR #38986:
URL: https://github.com/apache/superset/pull/38986#discussion_r3023543454


##########
superset/result_set.py:
##########
@@ -116,8 +116,16 @@ def __init__(  # pylint: disable=too-many-locals  # noqa: 
C901
 
         if cursor_description:
             # get deduped list of column names
+            # Some databases (e.g. SQL Server) return an empty string as the
+            # column name for un-aliased expressions like SELECT COUNT(*).
+            # An empty field name is illegal in NumPy structured arrays and in
+            # PyArrow tables, so we substitute a synthetic name when needed.
+            # See https://github.com/apache/superset/issues/23848
             column_names = dedup(
-                [convert_to_string(col[0]) for col in cursor_description]
+                [
+                    convert_to_string(col[0]) or f"_col_{i}"
+                    for i, col in enumerate(cursor_description)
+                ]

Review Comment:
   @sfirke This is a good suggestion to make the code safer



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