sadpandajoe commented on code in PR #42735:
URL: https://github.com/apache/superset/pull/42735#discussion_r3727161617


##########
superset/charts/client_processing.py:
##########
@@ -379,8 +379,17 @@ def apply_client_processing(  # noqa: C901
             # reports to avoid unwanted conversions
             # This allows users to control which values should be treated as 
null/NA
             na_values = current_app.config["REPORTS_CSV_NA_NAMES"]
+            # QueryContextProcessor.get_data encodes CSV `data` to bytes using
+            # the configured CSV_EXPORT encoding (default utf-8), matching
+            # the encoding SQL Lab's own CSV export uses -- decode with that
+            # same encoding rather than assuming `data` is already a `str`.
+            csv_data = (
+                data.decode(csv_export_config.get("encoding", "utf-8"))
+                if isinstance(data, bytes)
+                else data
+            )

Review Comment:
   Whitespace-only CSV bytes still bypass the existing no-data guard because 
decoding happens after the `str.strip()` check; for example, a columnless frame 
is serialized as a truthy BOM/newline payload and then reaches `pd.read_csv`, 
which raises `EmptyDataError`. Should we decode CSV bytes before the 
strip/empty check and extend the existing no-data parametrization with the 
bytes forms?



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