-
Notifications
You must be signed in to change notification settings - Fork 594
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 Enum support #14658
Comments
After digging a bit into this, it seems like there's no easy way to support inserting Strings into Enums. Instead allowing Int16s to be inserted into Enum8/16 is pretty easy, PR following. For my use cases this is fine, although a little annoying.
|
See PR for further info - I've only managed to get Enum16 working. My dataset isn't that huge so this is fine for me. Supporting Enum8 would be more work and I'm not sure how critical. Example Queries I've used, which demonstrate fairly well that string insertion is trivial to work around, although a maintenance burden:Clickhouse: CREATE TABLE matches_summary(
matchid UInt64,
region Enum16(
'BR1' = 1,
'EUN1' = 2,
'EUW1' = 3,
...
),
ts DateTime64
) ENGINE = ReplacingMergeTree
PRIMARY KEY (region, matchid)
ORDER BY (region, matchid, ts)
TTL toDateTime(ts + INTERVAL 90 DAY); CREATE SINK ch_matches_summary
AS (
WITH id_mapping AS (
SELECT str, num FROM (
SELECT 'BR1' AS str, 1 AS num
UNION ALL
SELECT 'EUN1', 2 UNION ALL
SELECT 'EUW1', 3 UNION ALL
...
)
)
SELECT matchId, id_mapping.num::smallint AS region, ts
FROM (...) AS temp
JOIN id_mapping ON temp.region = id_mapping.str
)
WITH (
connector = 'clickhouse',
type = 'append-only',
clickhouse.url = 'http://clickhouse:8123',
clickhouse.user = 'default',
clickhouse.password = '',
clickhouse.database = 'default',
clickhouse.table = 'matches_summary',
primary_key = 'matchid'
); |
Currently enum16 has been implemented, enum8 can't correspond to int8 because rw doesn't have a int8, so close this issue |
Is your feature request related to a problem? Please describe.
I'm trying to efficiently insert a risingwave String into a Clickhouse table which uses Enum8.
Describe the solution you'd like
I'd like it to be possible to sink Risingwaves String into Clickhouse Enum8s.
Describe alternatives you've considered
If an equivalent risingwave type existed, converting to that and inserting that into clickhouse would be fine also, but I'm not aware of such a type.
Additional context
Clickhouse Enum Docs
Current Error:
The text was updated successfully, but these errors were encountered: