jerwen opened a new issue #15905: URL: https://github.com/apache/superset/issues/15905
Impossible to render a chart, say a TableView, presenting a Time column when the global async query feature is enabled. ### Expected results We expected the chart to be rendered with the data on display. ### Actual results Error message on display. #### Screenshots <img width="1407" alt="Capture d’écran 2021-07-27 à 12 13 02" src="https://user-images.githubusercontent.com/20145870/127137342-1e86a9a7-545b-4665-b5ef-9b0bf76360a4.png"> #### How to reproduce the bug 1. Enable Global Async Query feature 2. Make sure to have a Redis configured for caching the result 3. Open a dashboard with a table view presenting a column Time 4. See error From the logs we have the following message `{"asctime": "2021-07-27 13:46:01,004", "name": "superset.views.base", "levelname": "WARNING", "process": 18, "message": "Unserializable object 10:30:00 of type <class 'datetime.time'>"}` ### Environment (please complete the following information): - superset version: `1.2` - python version: `3.7.9` - node.js version: `Unknown` ### Checklist Make sure to follow these steps before submitting your issue - thank you! - [X] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [X] I have reproduced the issue with at least the latest released version of superset. - [X] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context I looked up in the code base to see where the message was coming from. I found out two different methods aiming to perform the same job which is to json serialize dates ```python def json_iso_dttm_ser(obj: Any, pessimistic: bool = False) -> str: """ json serializer that deals with dates >>> dttm = datetime(1970, 1, 1) >>> json.dumps({'dttm': dttm}, default=json_iso_dttm_ser) '{"dttm": "1970-01-01T00:00:00"}' """ val = base_json_conv(obj) if val is not None: return val if isinstance(obj, (datetime, date, time, pd.Timestamp)): obj = obj.isoformat() else: if pessimistic: return "Unserializable [{}]".format(type(obj)) raise TypeError("Unserializable object {} of type {}".format(obj, type(obj))) return obj def json_int_dttm_ser(obj: Any) -> float: """json serializer that deals with dates""" val = base_json_conv(obj) if val is not None: return val if isinstance(obj, (datetime, pd.Timestamp)): obj = datetime_to_epoch(obj) elif isinstance(obj, date): obj = (obj - EPOCH.date()).total_seconds() * 1000 else: raise TypeError("Unserializable object {} of type {}".format(obj, type(obj))) return obj ``` It seems to me that the second might be at fault here. -- 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]
