maratbakiev2 opened a new issue, #23883:
URL: https://github.com/apache/superset/issues/23883

   When I'm trying to use time range filter on chart built on top of datasource 
from ClickHouse that has DateTime('UTC') as a time column it fails.
   
   #### How to reproduce the bug
    
   1. Create clickhouse table with DateTime('UTC') column and make a dataset in 
Superset from it. Create any chart and put it on the dashboard
   2. Create time range filter and apply it
   5. See error
   
   ### Expected results
   
   I've expected the values to be correctly filtered
   
   ### Actual results
   
   After applying the filter all the charts that have this column as time 
column disappear and the error is shown
   
   #### Screenshots
   
   <img width="1128" alt="image" 
src="https://user-images.githubusercontent.com/37618176/235335610-9f9e3cd3-b2d9-4128-b3d7-ecbc4d218d41.png";>
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Chrome Version 112.0.5615.137 (Official Build) 
(arm64)
   - superset version: `2.0.1`
   - python version: `3.8.12`
   - node.js version: `not relevant`
   - any feature flags active: no
   
   ### Checklist
   
   Completed
   
   ### Additional context
   
   superset logs for the error
   
   2023-04-28 08:57:53,906:ERROR:clickhouse_connect.driver.httpclient:Code: 53. 
DB::Exception: Cannot convert string 2023-04-21 00:00:00.000000 to type 
DateTime('UTC'): while executing 'FUNCTION greaterOrEquals(fact_new_at : 1, 
'2023-04-21 00:00:00.000000' : 2) -> greaterOrEquals(fact_new_at, '2023-04-21 
00:00:00.000000') UInt8 : 4'. (TYPE_MISMATCH) (version 22.3.19.6 (official 
build))
   
   Query SELECT toStartOfDay(toDateTime(fact_new_at)) AS __timestamp,
   count(order_id) AS COUNT(order_id)
   FROM marts.fact_orders
   WHERE fact_new_at >= '2023-04-21 00:00:00.000000'
   AND fact_new_at < '2023-04-28 00:00:00.000000'
   GROUP BY toStartOfDay(toDateTime(fact_new_at))
   ORDER BY COUNT(order_id) DESC
   LIMIT 10000 on schema marts failed
   Traceback (most recent call last):
   File "/app/superset/connectors/sqla/models.py", line 1920, in query
   df = self.database.get_df(sql, self.schema, mutator=assign_column_label)
   File "/app/superset/models/core.py", line 458, in get_df
   self.db_engine_spec.execute(cursor, sqls[-1])
   File "/app/superset/db_engine_specs/base.py", line 1261, in execute
   raise cls.get_dbapi_mapped_exception(ex)
   File "/app/superset/db_engine_specs/base.py", line 1259, in execute
   cursor.execute(query)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/dbapi/cursor.py", 
line 50, in execute
   query_result = self.client.query(operation, parameters)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/client.py", 
line 178, in query
   return self._query_with_context(query_context)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 207, in _query_with_context
   response = self._raw_request(body,
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 387, in _raw_request
   self._error_handler(response)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 323, in _error_handler
   raise OperationalError(err_str) if retried else DatabaseError(err_str) from 
None
   clickhouse_connect.driver.exceptions.DatabaseError: :HTTPDriver for 
http://chi-simple-nonreplicated-0-0.stable.svc.cluster.local:8123/ returned 
response code 400)
   Code: 53. DB::Exception: Cannot convert string 2023-04-21 00:00:00.000000 to 
type DateTime('UTC'): while executing 'FUNCTION greaterOrEquals(fact_new_at : 
1, '2023-04-21 00:00:00.000000' : 2) -> greaterOrEquals(fact_new_at, 
'2023-04-21 00:0
   2023-04-28 08:57:53,907:WARNING:superset.connectors.sqla.models:Query SELECT 
toStartOfDay(toDateTime(fact_new_at)) AS __timestamp,
   count(order_id) AS COUNT(order_id)
   FROM marts.fact_orders
   WHERE fact_new_at >= '2023-04-21 00:00:00.000000'
   AND fact_new_at < '2023-04-28 00:00:00.000000'
   GROUP BY toStartOfDay(toDateTime(fact_new_at))
   ORDER BY COUNT(order_id) DESC
   LIMIT 10000 on schema marts failed
   Traceback (most recent call last):
   File "/app/superset/connectors/sqla/models.py", line 1920, in query
   df = self.database.get_df(sql, self.schema, mutator=assign_column_label)
   File "/app/superset/models/core.py", line 458, in get_df
   self.db_engine_spec.execute(cursor, sqls[-1])
   File "/app/superset/db_engine_specs/base.py", line 1261, in execute
   raise cls.get_dbapi_mapped_exception(ex)
   File "/app/superset/db_engine_specs/base.py", line 1259, in execute
   cursor.execute(query)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/dbapi/cursor.py", 
line 50, in execute
   query_result = self.client.query(operation, parameters)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/client.py", 
line 178, in query
   return self._query_with_context(query_context)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 207, in _query_with_context
   response = self._raw_request(body,
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 387, in _raw_request
   self._error_handler(response)
   File 
"/usr/local/lib/python3.8/site-packages/clickhouse_connect/driver/httpclient.py",
 line 323, in _error_handler
   raise OperationalError(err_str) if retried else DatabaseError(err_str) from 
None
   clickhouse_connect.driver.exceptions.DatabaseError: :HTTPDriver for 
http://chi-simple-nonreplicated-0-0.stable.svc.cluster.local:8123/ returned 
response code 400)
   Code: 53. DB::Exception: Cannot convert string 2023-04-21 00:00:00.000000 to 
type DateTime('UTC'): while executing 'FUNCTION greaterOrEquals(fact_new_at : 
1, '2023-04-21 00:00:00.000000' : 2) -> greaterOrEquals(fact_new_at, 
'2023-04-21 00:0
   


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