sbdelisle opened a new issue #15876:
URL: https://github.com/apache/superset/issues/15876


   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](https://s3.us-east-2.amazonaws.com/hdx-public/rawtestdata/clickhouse-api-type/raw/non_negative/clickhouse_types_positive_ints_1.csv)
   
[clickhouse_types_positive_ints2.csv](https://s3.us-east-2.amazonaws.com/hdx-public/rawtestdata/clickhouse-api-type/raw/non_negative/clickhouse_types_positive_ints_2.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](https://github.com/sbdelisle/superset/commit/015eb213a26fa16be82f6d4bd94328a776f43419)
 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](https://user-images.githubusercontent.com/55761624/126841600-1853c856-78c1-43d6-b7b5-ca1c0dd8926f.png)
   
   
   #### 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!
   
   - [x] 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]
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   


-- 
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]

Reply via email to