ClickHouse/metabase-clickhouse-driver

Column filter "startsWith" defaults to "startsWithUTF8"

djuarezg opened this issue · 4 comments

Steps to reproduce

  1. Set up a CH database
  2. Go to as a question on a CH table
  3. Click on filter for a string column
  4. Apply a "Starts with" filter on the given column

image

If you go to the generated SQL question and edit the used function yourself all works fine

Expected behaviour

Do not use startsWithUTF8 on the applied filter when using filters through the UI instead of writing the full SQL question, or at least do not take for granted that CH has that function which is only available from https://clickhouse.com/docs/en/whats-new/changelog/2023#238 version

Error log

Code: 46. DB::Exception: Unknown function startsWithUTF8. Maybe you meant: ['startsWith']: While processing startsWithUTF8(lowerUTF8(deviceTypes), lowerUTF8('desktop')). (UNKNOWN_FUNCTION) (version 23.3.2.37 (official build))\n, server ClickHouseNode [uri=https://bimbadabum:9001/default, options={sslrootcert=/etc/certs/cert_ca.crt,socket_timeout=42000000,connect_timeout=42000000,receive_timeout=42000000,send_timeout=42000000,use_server_time_zone_for_dates=true,use_no_proxy=true,product_name=metabase/1.3.3}]@-1310317476

Configuration

Environment

  • metabase-clickhouse-driver version: 1.3.3
  • Metabase version: v0.48.3
  • OS: Metabase Docker image

ClickHouse server

  • ClickHouse Server version: 23.3.2.37
  • LowCardinality(Nullable(String)) fields

What would be the preferred solution, given that 23.3 should be EOL when 24.3 is out and it's better to keep the Unicode versions of the startWith/endWith/lower/position functions in the driver by default?

Maybe some kind of a driver configuration toggle (indicating that the ClickHouse deployment is <23.8)?

EDIT: apologies for this issue, I should've checked the changelog when implementing it, as the functions descriptions were not mentioning the release version at the time. However, thanks to this one, they do now.

if the driver can identify somehow the version that would be great, otherwise a user-defined flag or conf would be sufficient.

if the driver can identify somehow the version that would be great

Yes, looks like it is the best solution. I'll check if this is possible to do from the driver in a clean way.