Hi , I just start some evaluation work on ClickHouse . When I created a table
and try to apply sumMap on ./clickhouse local mode as below , everything works fine.
CREATE TABLE session_hourly
(
`CustomerId` UInt32,
`Time` DateTime,
`PlayMinutes` Array(UInt8)
)
ENGINE = MergeTree
ORDER BY CustomerId
INSERT INTO session_hourly VALUES (1,'2021-12-08 01:00:00',[3,5,7,9,10])
INSERT INTO session_hourly VALUES (2,'2021-12-08 01:00:00',[3,5,7,8,9])
INSERT INTO session_hourly VALUES (3,'2021-12-08 02:00:00',[3,5,7,8,9])
SELECT
Time,
sumMap(cast(arrayMap(x -> (x, 1), PlayMinutes), 'Map(UInt8,UInt8)')) AS smap
FROM session_hourly
GROUP BY Time
┌────────────────Time─┬─smap───────────────────────┐
│ 2021-12-08 01:00:00 │ {3:2,5:2,7:2,8:1,9:2,10:1} │
│ 2021-12-08 02:00:00 │ {3:1,5:1,7:1,8:1,9:1} │
└─────────────────────┴────────────────────────────┘
everything works good so I can convert an Array to Map and apply sumMap on it.
But when I post exactly the same query with the same binary (start with cmd clickhouse-client)
Got the error msg : Received exception from server (version 21.11.5):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: When function sumMap gets one argument it must be a tuple. (ILLEGAL_TYPE_OF_ARGUMENT)
So , does this kind of discrepancy is expected between local mode and server mode or maybe it's a bug?
Thanks!