john-bodley commented on code in PR #26946:
URL: https://github.com/apache/superset/pull/26946#discussion_r1474998517


##########
superset/models/helpers.py:
##########
@@ -1378,6 +1381,8 @@ def values_for_column(
             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})

Review Comment:
   What I'm somewhat perplexed about is why historically this hasn't been an 
issue? I'm also not entirely sure when  the `values_for_column` function is 
invoked.
   
   Note it seems like Trino et al. support 
[NaNs](https://trino.io/docs/current/functions/math.html), though interesting 
in SQL Lab if I run `SELECT nan()` the result set renders `NULL`—which is 
likely being handled the the DB-API.



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to