You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2024/02/01 02:24:10 UTC

(superset) branch fix-athena-nan created (now 7b8f11718f)

This is an automated email from the ASF dual-hosted git repository.

beto pushed a change to branch fix-athena-nan
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 7b8f11718f fix: column values with NaN

This branch includes the following new commits:

     new 7b8f11718f fix: column values with NaN

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: fix: column values with NaN

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch fix-athena-nan
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7b8f11718ffe9eccfebfcb638419c4d798b48a66
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Jan 31 21:18:01 2024 -0500

    fix: column values with NaN
---
 superset/models/helpers.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index fa2c9b8102..9322e8c46d 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -1340,7 +1340,10 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
         return and_(*l)
 
     def values_for_column(
-        self, column_name: str, limit: int = 10000, denormalize_column: bool = False
+        self,
+        column_name: str,
+        limit: int = 10000,
+        denormalize_column: bool = False,
     ) -> list[Any]:
         # denormalize column name before querying for values
         # unless disabled in the dataset configuration
@@ -1378,6 +1381,8 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
             sql = self.mutate_query_from_config(sql)
 
             df = pd.read_sql_query(sql=sql, con=engine)
+            # replace NaN with None to ensure it can be serialized to JSON
+            df = df.replace({np.nan: None})
             return df["column_values"].to_list()
 
     def get_timestamp_expression(