![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
clickhouse
clickhouse
陌丶尘
这个作者很懒,什么都没留下…
展开
-
clickhouse toFloat64 toFloat64OrZero
toFloat64 里面的参数可以是数字和字符串toFloat64OrZero里面的参数只能是字符串和特殊的数字-- 报错select toFloat64OrZero(123) as a-- 123select toFloat64OrZero('123') as a-- 0select toFloat64OrZero('123ghj') as a-- Nanselect toFloat64OrZero('Nan') as a-- 123select toFloat64(123)原创 2022-04-02 17:13:35 · 2445 阅读 · 0 评论 -
clickhouse There is no supertype for types UInt64, Float64
There is no supertype for types UInt64, Float64进行union all操作的时候,发现有两个字段名称相同,但是类型不同,所以出现了这个字段,如下:解决方案:统一转Float64类型(因人而异)原创 2022-04-02 15:59:46 · 1447 阅读 · 0 评论 -
clickhouse ifNotFinite
ifNotFinite(x,y);如果x不是Nan,Infinity,那么就取x,否则就取y,x可以是小数.-- sql1SELECT 0/2 as infimum, ifNotFinite(infimum,42);-- sql2SELECT 1/0 as infimum, ifNotFinite(infimum,42);-- sql3SELECT 1/2 as infimum, ifNotFinite(infimum,42);sql1:sql2:sql3:...原创 2022-04-02 09:50:11 · 810 阅读 · 0 评论 -
clickhouse uniqIf使用
例子如下:-- sqlselect uniq(device_id)from com_vv_binguoWHERE toDate(time_stamp) >= '2021-12-20' and event_name = '启动';-- sql2-- ps:uniqIf是在where之后执行的,所以性能会差select uniqIf(device_id, toDate(time_stamp) >= '2021-12-20' and event_name = '启动') as a原创 2022-04-01 15:47:09 · 1114 阅读 · 0 评论 -
clickhouse uniqCombined
mysql中的 count(distinct column)与ck中uniq相比消耗内存要少几倍。计算精度高出几倍。通常具有略低的性能。 在某些情况下, uniqCombined 可以表现得比 uniq 好,例如,使用通过网络传输大量聚合状态的分布式查询。ps: 由于它对非 String 类型使用32位哈希,对于基数显著大于UINT_MAX ,结果将有非常高的误差(误差将在几百亿不同值之后迅速提高), 因此这种情况,你应该使用 uniqCombined64...原创 2022-04-01 14:12:53 · 1721 阅读 · 0 评论