question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Python int too large to convert to C long` after sqllab query

See original GitHub issue

When 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

image

How to reproduce the bug

  1. Go to the SQL Lab tag
  2. Enter the query SELECT _uint64 from sample_project.sample_table where _uint64 < 9236385016688793473; in the query box
  3. click run
  4. 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:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
rabihsalibacommented, May 4, 2022

This issue is still happening in version 1.5.0

0reactions
stale[bot]commented, Apr 30, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`Python int too large to convert to C long` after sqllab query
[GitHub] [superset] sbdelisle commented on issue #15876: `Python int too large to convert to C long` after sqllab query.
Read more >
[Solved] OverflowError: Python int too large to convert to C long
OverflowError: Python int too large to convert to C long error occurs when data type value storage exceeds the range.
Read more >
Python int too large to convert to C long" on windows but not ...
OverflowError: Python int too large to convert to C long. Now try with float conversion: df['temp'] = df['temp'].astype(float).
Read more >
OverflowError: Python int too large to convert to C long
I read an entire dialog about 34 on this forum from AUG 22, i.e. this year. Please forget the past and this message...
Read more >
Installation & Configuration - apache-superset - Read the Docs
Superset is battle tested in large environments with hundreds of concurrent users. ... sudo yum upgrade python-setuptools sudo yum install gcc gcc-c++ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found