`Python int too large to convert to C long` after sqllab query
See original GitHub issueWhen trying to query a sample dataset through sqllab, I received the error Python int too large to convert to C long.
It appears the error is occuring in Superset’s response processing code.
This is running commit id 040b94119
from the apache/superset git master branch.
I have the following files loaded into my Hydrolix database (interface compatible with Clickhouse): clickhouse_types_positive_ints1.csv clickhouse_types_positive_ints2.csv
The schema of the database describes the _uint64 column to be of type Nullable(UInt64)
I make the following query against the Hydrolix database:
SELECT _uint64 from sample_project.sample_table where _uint64 < 9236385016688793473;
I receive the error Python int too large to convert to C long.
If I make a query comparing against a slightly smaller number:
SELECT _uint64 from sample_project.sample_table where _uint64 < 9236385016688793472;
I get a result column of 1040 numbers and no error.
I get the following stack trace in the superset logs:
superset_app | 2021-07-23 20:48:11,314:WARNING:superset.views.base:[SupersetError(message='Python int too large to convert to C long', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'ClickHouse', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
superset_app | Traceback (most recent call last):
superset_app | File "/app/superset/views/base.py", line 204, in wraps
superset_app | return f(self, *args, **kwargs)
superset_app | File "/app/superset/utils/log.py", line 241, in wrapper
superset_app | value = f(*args, **kwargs)
superset_app | File "/app/superset/views/core.py", line 2573, in sql_json
superset_app | return self.sql_json_exec(request.json, log_params)
superset_app | File "/app/superset/views/core.py", line 2774, in sql_json_exec
superset_app | session, rendered_query, query, expand_data, log_params
superset_app | File "/app/superset/views/core.py", line 2558, in _sql_json_sync
superset_app | [SupersetError(**params) for params in data["errors"]]
superset_app | superset.exceptions.SupersetErrorsException: [SupersetError(message='Python int too large to convert to C long', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine
_name': 'ClickHouse', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
It looked like the above was swallowing an exception, so I made a small code modification to log it:
superset_app | Traceback (most recent call last):
superset_app | File "/app/superset/sql_lab.py", line 459, in execute_sql_statements
superset_app | statement, query, user_name, session, cursor, log_params, apply_ctas,
superset_app | File "/app/superset/sql_lab.py", line 297, in execute_sql_statement
superset_app | return SupersetResultSet(data, cursor_description, db_engine_spec)
superset_app | File "/app/superset/result_set.py", line 109, in __init__
superset_app | pa_data.append(pa.array(array[column].tolist()))
superset_app | File "pyarrow/array.pxi", line 306, in pyarrow.lib.array
superset_app | File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
superset_app | File "pyarrow/error.pxi", line 141, in pyarrow.lib.pyarrow_internal_check_status
superset_app | OverflowError: Python int too large to convert to C long
For my immediate purposes I have composed this patch to avoid the error in a way that I suspect would not be portlable to different databases.
Expected results
I expect to be able to view results in Superset for a query of integers stored in my database as UInt64 that are larger than 9236385016688793472.
Actual results
I see a en error, Python int too large to convert to C long,
instead of results.
Screenshots
How to reproduce the bug
- Go to the SQL Lab tag
- Enter the query
SELECT _uint64 from sample_project.sample_table where _uint64 < 9236385016688793473;
in the query box - click run
- See error output in red
Environment
running superset via docker-compose -f docker-compose.yml up
from a git checkout of version 040b94119
python and node.js versions should follow from the above info.
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [-] I have reproduced the issue with at least the latest released version of superset. [the issue applies to the head of the master branch]
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5
Top GitHub Comments
This issue is still happening in version 1.5.0
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue
.pinned
to prevent stale bot from closing the issue.