QuesmaOrg / quesma

Programmable database gateway
https://quesma.com
Other
105 stars 6 forks source link

`DateTime` (not `DateTime64(3)`!) support for `@timestamp` column #988

Open avelanarius opened 1 day ago

avelanarius commented 1 day ago

When a ClickHouse table has a DateTime @timestamp column, Quesma fails with:

Nov 13 14:57:22.217 ERR quesma/quesma/quesma.go:156 > quesma request failed: Q3006: Unspecified database error.  clickhouse: query failed. err: code: 169, message: Key expression contains comparison between inconvertible types: DateTime and DateTime64(3) inside timestamp >= fromUnixTimestamp64Milli(1731508941381), query: SELECT sum(count(*)) OVER () AS "metric____quesma_total_count_col_0", toInt64((toUnixTimestamp("timestamp")+timeZoneOffset(toTimezone("timestamp",'Europe/Warsaw'))) / 30) AS "aggr__0__key_0", count(*) AS "aggr__0__count" FROM akamai.siem WHERE ("timestamp">=fromUnixTimestamp64Milli(1731508941381) AND "timestamp"<=fromUnixTimestamp64Milli(1731509841381)) GROUP BY toInt64((toUnixTimestamp("timestamp")+timeZoneOffset(toTimezone("timestamp",'Europe/Warsaw'))) / 30) AS "aggr__0__key_0" ORDER BY "aggr__0__key_0" ASC
-- optimizations: pancake(half)
: code: 169, message: Key expression contains comparison between inconvertible types: DateTime and DateTime64(3) inside timestamp >= fromUnixTimestamp64Milli(1731508941381) opaque_id=406c23d9-1d72-4567-a6c6-d51c859d7221;kibana:application:discover:;application:discover:new;lens:lnsXY:unifiedHistogramLensComponent path=/siem*/_async_search reason="Unspecified database error." request_id=01932607-6e3b-74f6-a8a2-593a043e757a
trzysiek commented 1 day ago

I think it only happens with Hydrolix, not Clickhouse, but still - PR with fix is in progress, should be fixed very soon.