Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClickHouse Connect Error clickhousedb error: year 584556016 is out of range on Apache Superset platform #204

Closed
cuche01 opened this issue Jun 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@cuche01
Copy link

cuche01 commented Jun 15, 2023

Describe the bug

Whenever I try to run a query to pull a date record of type datetime64 that is less than 1960, I get the following error:
ClickHouse Connect Error
clickhousedb error: year 584556016 is out of range

This may be triggered by:
Issue 1002 - The database returned an unexpected error.

The same query runs well on the clickhouse database using tabix, but fails on Apache superset

Steps to reproduce the bug

  1. Go to SQL -> SQL Lab
  2. Choose any clickhouse database
  3. Write a query to pull date records (of data type datetime64) before '1970'
  4. See error

Screenshot

image

Expected behaviour

The query should produce a result table
image

Code example

SELECT date_of_birth
FROM `recorddb`.`client_records`
WHERE date_of_birth < '1969-01-01'

clickhouse-connect and/or ClickHouse server logs

superset_app | 2023-06-15 14:51:18,369:INFO:superset.sql_lab:Query 60: Executing 1 statement(s)
superset_app | Query 60: Set query to 'running'
superset_app | 2023-06-15 14:51:18,369:INFO:superset.sql_lab:Query 60: Set query to 'running'
superset_app | Query 60: Running statement 1 out of 1
superset_app | 2023-06-15 14:51:18,425:INFO:superset.sql_lab:Query 60: Running statement 1 out of 1
superset_app | SupersetErrorsException
superset_app | Traceback (most recent call last):
superset_app | File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
superset_app | rv = self.dispatch_request()
superset_app | File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
superset_app | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
superset_app | File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
superset_app | return f(self, *args, **kwargs)
superset_app | File "/app/superset/views/base_api.py", line 122, in wraps
superset_app | raise ex
superset_app | File "/app/superset/views/base_api.py", line 113, in wraps
superset_app | duration, response = time_function(f, self, *args, **kwargs)
superset_app | File "/app/superset/utils/core.py", line 1586, in time_function
superset_app | response = func(*args, **kwargs)
superset_app | File "/app/superset/views/base_api.py", line 85, in wraps
superset_app | return f(self, *args, **kwargs)
superset_app | File "/app/superset/utils/log.py", line 266, in wrapper
superset_app | value = f(*args, **kwargs)
superset_app | File "/app/superset/sqllab/api.py", line 256, in execute_sql_query
superset_app | command_result: CommandResult = command.run()
superset_app | File "/app/superset/sqllab/commands/execute.py", line 120, in run
superset_app | raise ex
superset_app | File "/app/superset/sqllab/commands/execute.py", line 102, in run
superset_app | status = self._run_sql_json_exec_from_scratch()
superset_app | File "/app/superset/sqllab/commands/execute.py", line 157, in _run_sql_json_exec_from_scratch
superset_app | raise ex
superset_app | File "/app/superset/sqllab/commands/execute.py", line 152, in _run_sql_json_exec_from_scratch
superset_app | return self._sql_json_executor.execute(
superset_app | File "/app/superset/sqllab/sql_json_executer.py", line 111, in execute
superset_app | raise SupersetErrorsException(
superset_app | superset.exceptions.SupersetErrorsException: [SupersetError(message='clickhousedb error: year 584556013 is out of range', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'ClickHouse Connect', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]

Configuration

Environment

  • clickhouse-connect version: 0.2.6
  • Python version: 3.8.10
  • Operating system: Ubuntu 20.04
@cuche01 cuche01 added the bug Something isn't working label Jun 15, 2023
@genzgd genzgd mentioned this issue Jun 16, 2023
2 tasks
@genzgd
Copy link
Collaborator

genzgd commented Jun 16, 2023

Thanks for the report. "negative" datetime64 dates were definitely broken. This will be fixed in the 0.6.3 release.

@cuche01
Copy link
Author

cuche01 commented Jun 16, 2023

Thanks, this is no longer an issue in the 0.6.3 release

@cuche01 cuche01 closed this as completed Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants