Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[ bug ]请简要描述Clickhouse集群DDL语句 命令报错 #1426

Closed
windyHe2020 opened this issue Mar 28, 2022 · 7 comments · Fixed by #1428
Closed

[ bug ]请简要描述Clickhouse集群DDL语句 命令报错 #1426

windyHe2020 opened this issue Mar 28, 2022 · 7 comments · Fixed by #1428

Comments

@windyHe2020
Copy link

windyHe2020 commented Mar 28, 2022

在提交 issue 前,请查阅以下资源,请先进行搜索来保证没有类似的 issue。
文档 | FAQ

重现步骤

1、Clickhouse集群SQL上线中:
执行语句:ALTER TABLE t1 on cluster bigdata ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间';/(ALTER TABLE t1 ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间';)
2、报错:
审核信息列:explain语法检查错误:Code: 62.
DB::Exception: Syntax error: failed at position 19 ('TABLE'): TABLE t1 on cluster bigdata ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间'. Expected one of: Equals, Dot, token.
3、手工去数据库中执行命令,命令成功。

期待结果和实际结果

期待结果:语句执行成功。

实际结果:SQL检查不通过,系统自动驳回。

截图

image

错误日志

[2022-03-28 15:49:43,051][MainThread:139859518359360][task_id:default][clickhouse.py:123][WARNING]- ClickHouse语句执行报错,语句:explain ast ALTER TABLE t1 on cluster bigdata ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间',错误信息Code: 62.
DB::Exception: Syntax error: failed at position 19 ('TABLE'): TABLE t1 on cluster bigdata ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间'. Expected one of: Equals, Dot, token. Stack trace:

  1. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Exception.cpp:27: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) @ 0x18b66d50 in /usr/lib/debug/usr/bin/clickhouse
  2. /build/obj-x86_64-linux-gnu/../src/Common/Exception.cpp:37: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) @ 0xe5bc32d in /usr/lib/debug/usr/bin/clickhouse
  3. /build/obj-x86_64-linux-gnu/../src/Parsers/parseQuery.cpp:325: DB::parseQuery(DB::IParser&, char const*, char const*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, unsigned long, unsigned long) (.cold) @ 0x1678fb1b in /usr/lib/debug/usr/bin/clickhouse
  4. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3696: DB::executeQueryImpl(char const*, char const*, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, DB::ReadBuffer*) @ 0x15b9852e in /usr/lib/debug/usr/bin/clickhouse
  5. /build/obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:675: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0x15b9a672 in /usr/lib/debug/usr/bin/clickhouse
  6. /build/obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:253: DB::TCPHandler::runImpl() @ 0x16235ed5 in /usr/lib/debug/usr/bin/clickhouse
  7. /build/obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:1219: DB::TCPHandler::run() @ 0x16236c40 in /usr/lib/debug/usr/bin/clickhouse
  8. /build/obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:57: Poco::Net::TCPServerConnection::start() @ 0x18a84d0b in /usr/lib/debug/usr/bin/clickhouse
  9. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:856: Poco::Net::TCPServerDispatcher::run() @ 0x18a85428 in /usr/lib/debug/usr/bin/clickhouse
  10. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/include/Poco/Mutex_POSIX.h:59: Poco::PooledThread::run() @ 0x18c03b26 in /usr/lib/debug/usr/bin/clickhouse
  11. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/include/Poco/AutoPtr.h:223: Poco::ThreadImpl::runnableEntry(void*) @ 0x18bfef20 in /usr/lib/debug/usr/bin/clickhouse
  12. start_thread @ 0x740b in /usr/lib64/libpthread-2.26.so
  13. __clone @ 0xed09f in /usr/lib64/libc-2.26.so

版本信息

应用版本/分支:
Archery (v1.8.3)
部署方式:Docker、手工部署
手工部署

@windyHe2020 windyHe2020 changed the title [ bug ]请简要描述Clickhouse集群DDL语句增加 on cluster 命令报错 [ bug ]请简要描述Clickhouse集群DDL语句 命令报错 Mar 28, 2022
@nick2wang
Copy link
Collaborator

麻烦提供下clickhouse实例的版本号,我本地使用v22.1.3.7测试没有报语法错误,可能是explain ast的兼容性问题

@nick2wang
Copy link
Collaborator

然后改写下sql重新检测下看是否还报错:
ALTER TABLE 表t1所在的数据库名.t1 on cluster bigdata ADD COLUMN create_time DateTime64(3) DEFAULT now64(3) COMMENT '创建时间';

@windyHe2020
Copy link
Author

麻烦提供下clickhouse实例的版本号,我本地使用v22.1.3.7测试没有报语法错误,可能是explain ast的兼容性问题

是的,看报错是explain ast的兼容性问题,我命令窗执行直接explain ast ……也会报错,加库名也是相同的报错。我用的版本是clickhouse 20.8.9.6,clickhouse的explain 好像做的不是很完善,太新的版本bug又比较多……
image

@nick2wang
Copy link
Collaborator

nick2wang commented Mar 28, 2022

explain ast从v21.1.2.15起才支持非select语句,后面我改下兼容问题,低版本先跳过检查

@windyHe2020
Copy link
Author

explain ast从v21.1.2.15起才支持非select语句,后面我改下兼容问题,低版本先跳过检查

好的,幸苦!如果跳过低版本跳过检查,语句执行报错时(包含语法错误),能不能考虑前台打印出来错误信息啊~

@nick2wang
Copy link
Collaborator

explain ast从v21.1.2.15起才支持非select语句,后面我改下兼容问题,低版本先跳过检查

好的,幸苦!如果跳过低版本跳过检查,语句执行报错时(包含语法错误),能不能考虑前台打印出来错误信息啊~

执行报错默认会展示到前台“审核/执行信息”字段

@windyHe2020
Copy link
Author

explain ast从v21.1.2.15起才支持非select语句,后面我改下兼容问题,低版本先跳过检查

好的,幸苦!如果跳过低版本跳过检查,语句执行报错时(包含语法错误),能不能考虑前台打印出来错误信息啊~

执行报错默认会展示到前台“审核/执行信息”字段

好的

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants