ClickHouse (十六)异常处理总结

  1. DB::Exception: Nested type Array(String) cannot be inside Nullable type (version 20.4.6.53 (official build))

原因:字段类型是Nullable(String),在使用一些字符串函数如splitByString,他们对Nullable类型是不支持的,需要转成String。
解决:使用cast强转一下字段类型就行:

select splitByString(',',cast(col as String)) col from test
  1. DB::Exception: Cannot convert NULL value to non-Nullable type: while converting source column second_channel to destination column second_channel (version 20.4.6.53 (official build))

原因:字段类型是非空类型,insert null值到非空字段second_channel会报错。
解决:可以将非空类型改成Nullable(String),但是要注意Nullable字段不允许用于order by。

  1. DB::Exception: Memory limit (total) exceeded: would use 113.20 GiB (attempt to allocate chunk of 134200512 bytes), maximum: 113.14 GiB: While executing CreatingSetsTransform. (version 20.4.6.53 (official build))

原因:单次查询出来的数据量,大于单台机器的剩余内存。
解决:可以将查询范围缩小,比如添加查询条件对查询结果取余,也可以清理或者添加物理机内存

  1. DB::Exception: MySQL database engine does not support create table. for tables that were detach or dropped before, you can use attach to add them back to the MySQL database (version 20.4.6.53 (official build))

  2. ClickHouse exception, code: 209, host: 192.168.0.1, port: 8123; Code: 209, e.displayText() = DB::NetException: Timeout exceeded while reading from socket (10.10.161.50:9000): while receiving packet from dc_clickhouse27:9000: While executing Remote (version 21.3.15.4 (official build))

  3. Cause: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: 192.168.0.1, port: 8123; ClickHouse response without column names

  4. Cause: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: 192.168.0.1, port: 8123; Connection reset

  5. e.displayText() = DB::Exception: Table columns structure in ZooKeeper is different from local table structure (version 20.12.3.3 (official build))
    原因:Replicated(副本)表删表重建,但zk中表结构删除操作是异步的,默认为五分钟
    解决:重启该节点的ck,或者选择等待几分钟内

  6. e.displayText() = DB::Exception: Different number of columns in UNION ALL elements
    原因:使用union all的两个查询语句查出不同数量的列字段

  7. e.displayText() = DB::ErrnoException: Cannot unlink file /srv/BigData/data2/clickhouse/store/1ef/f386-24b2-4ce0-8ebd-e78/format_version.txt, errno: 2, strerror: No such file or directory (version 21.3.4.25)

  8. e.displayText() = DB::Exception: AST is too big. Maximum: 500000: (after expansion of aliases) (version 21.3.4.25)
    ast(abstract syntax tree)抽象语法树,此处是超过查询语法树中的最大元素数,所以抛出异常。 简单来说就是写的sql太长了,可以缩短sql来解决

  9. DB::Exception: Received from clickhouse-06:9000. DB::Exception: Too many simultaneous queries. Maximum: 400. Stack trace:
    并行写入数据太多,导致树合并频率过高,查询速度下降,链接被慢查询占用,后续该节点任务全部失败,只能重启该节点。

  10. e.displayText() = DB::Exception: Table is in readonly mode (zookeeper path: /clickhouse/ods/ods_test_data): While executing SinkToOutputStream (version 21.3.15.4 (official build))
    原因:这是在写入的时候,表处于只读状态,原因zookeeper异常导致,所以所有插入均失败了
    解决:重启ck集群和zk集群,

  • 7
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

高并发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值