ClickHouse / metabase-clickhouse-driver

ClickHouse database driver for the Metabase business intelligence front-end
Apache License 2.0
476 stars 92 forks source link

numeric column value is casted to Uint32 for string column #171

Closed taylorchu closed 1 year ago

taylorchu commented 1 year ago

Describe the bug

Steps to reproduce

  1. create a column with type string
  2. pick filter by column and enter numeric value.

Expected behaviour

numeric value is casted to string correctly instead of Uint32.

Error log

 There is no supertype for types String, UInt32 because some of them are String/FixedString and some of them are not: while executing 'FUNCTION equals(call_id : 0, 23686716 : 1) -> equals(call_id, 23686716) UInt8 : 2'. (NO_COMMON_TYPE) (version 23.5.1.3174 (official build)) , server ClickHouseNode [uri=http://clickhouse-logging:8123/app, options={use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.1.6}]@-1516141321

Configuration

Environment

slvrtrn commented 1 year ago

metabase-clickhouse-driver version: 0.16.0

@taylorchu, thanks for the report.

I checked it with Metabase 0.46.5 and driver version 1.1.6, and for me there were no issues/exceptions:

image

DESCRIBE TABLE test_sessions

┌─name─────────┬─type─────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ session_id   │ UInt64   │              │                    │         │                  │                │
│ session_name │ String   │              │                    │         │                  │                │
│ created_at   │ DateTime │              │                    │         │                  │                │
└──────────────┴──────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘

Can you please confirm that the issue is not reproducible on the latest driver version? And if it still is, can you please provide a DDL/minimal dataset?

taylorchu commented 1 year ago

I am closing this. I found this issue is actually from metabase. Metabase has a cached version of schema. When you change column type from numeric to string in clickhouse, you should also remove this cache in metabase to avoid this problem.