Open Molrn opened 6 months ago
Is this bug? Or unsupported? If it's a bug, I would like to fix it.
Can some help me to point serialization code. I have tried debugging, but not able to find that due to missing of stack in catch and throw.
For this "Unserializable object [2022-06-08 15:17:43.554000+00:00, 2022-06-09 15:17:49.528000+00:00] of type <class 'psycopg2._range.DateTimeTZRange'>" only message has been captured and thrown but its missing stack trace. This is coming as errors of data object from get_sql_query_results task.
I have done dump of data object, unfortunately on errors it only on contains error message but not stacktrace
Dump of data object at L110
superset_app | 2024-04-28 02:05:25,134:INFO:superset.sqllab.sql_json_executer:{'query_id': 25, 'status': 'failed', 'error': "Unserializable object [2023-04-27 08:00:00+00:00, 2023-04-27 10:00:00+00:00) of type <class 'psycopg2._range.DateTimeTZRange'>", 'errors': [{'message': "Unserializable object [2023-04-27 08:00:00+00:00, 2023-04-27 10:00:00+00:00) of type <class 'psycopg2._range.DateTimeTZRange'>", 'error_type': <SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, 'level': <ErrorLevel.ERROR: 'error'>, 'extra': {'engine_name': 'PostgreSQL', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]}}]}
Able to extract stacktrace - its issue with converting numpy to pyArray
superset_app | 2024-04-29 17:26:16,337:ERROR:superset.result_set:Could not convert DateTimeTZRange(datetime.datetime(2023, 4, 27, 8, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2023, 4, 27, 10, 0, tzinfo=datetime.timezone.utc), '[)') with type DateTimeTZRange: did not recognize Python value type when inferring an Arrow data type
superset_app | Traceback (most recent call last):
superset_app | File "/app/superset/result_set.py", line 141, in __init__
superset_app | pa_data.append(pa.array(array[column].tolist()))
superset_app | File "pyarrow/array.pxi", line 344, in pyarrow.lib.array
superset_app | File "pyarrow/array.pxi", line 42, in pyarrow.lib._sequence_to_array
superset_app | File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
superset_app | File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
@sfirke can you assign this task to me.
Bug description
Superset returns an error when I try a query with an array_agg on a tstzrange column. The same error was previously returned in #19995 when querying a tstzrange column on its own (which does not return any error in my superset version).
How to reproduce the bug
Considering Superset have a connection to a PostgreSQL database and there is a table with one column of type tstzrange, go to "SQL Lab" -> "SQL Editor" and try a select query that includes an array_agg on the tstzrange column. e.g:
SELECT ARRAY_AGG(date_range) FROM tstzrange_example
.SELECT date_range FROM tstzrange_example
should work (resolved in #19995)Screenshots/recordings
Superset version
3.1.2
Python version
3.9
Node version
I don't know
Browser
Firefox
Additional context
Logs
Checklist