Skip to content

Bug: Array(Bool) doesn't accept [1,0] style value, but @clickhouse/client forcibly converts [true, false] to [1, 0]. #476

@baseballyama

Description

@baseballyama

Company or project name

Flyle.inc

Describe what's wrong

Array(Bool) currently does not accept [0, 1] style values.
This could likely be addressed as a feature request on the ClickHouse side, but the problem is that the Node.js @clickhouse/client library forcibly rewrites [true, false] to [1, 0].
Because of this behavior, there is no workaround for the issue at the moment.

✅
clickhouse client --query "SELECT hasAll([true,false], {vals:Array(Bool)})" --param_vals='[true,false]' --password 'password'

🙅
clickhouse client --query "SELECT hasAll([true,false], {vals:Array(Bool)})" --param_vals='[1,0]' --password 'password'

Bool (Not Array(Bool)) works nicely.

✅
clickhouse client --query "SELECT true = {vals:Bool}" --param_vals=true --password 'password'

✅
clickhouse client --query "SELECT true = {vals:Bool}" --param_vals=1 --password 'password'

Does it reproduce on the most recent release?

Yes

How to reproduce

See above.

Expected behavior

No response

Error message and/or stacktrace

2025.10.21 05:07:47.453025 [ 1727 ] {} <Error> TCPHandler: Code: 130. DB::Exception: Cannot read array from text, expected comma or end of array, found '1': value [1,0] cannot be parsed as Array(Bool) for query parameter 'vals'. (CANNOT_READ_ARRAY_FROM_TEXT), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000010ff8330
1. DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000b960d98
2. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000b960868
3. DB::Exception::Exception<char&>(int, FormatStringHelperImpl<std::type_identity<char&>::type>, char&) @ 0x00000000112ac538
4. DB::SerializationArray::deserializeText(DB::IColumn&, DB::ReadBuffer&, DB::FormatSettings const&, bool) const @ 0x00000000145d0d98
5. DB::ReplaceQueryParameterVisitor::visitQueryParameter(std::shared_ptr<DB::IAST>&) @ 0x00000000156b0ea0
6. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
7. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
8. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
9. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
10. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
11. DB::ReplaceQueryParameterVisitor::visitChildren(std::shared_ptr<DB::IAST>&) @ 0x00000000156b1454
12. DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>) @ 0x00000000156c456c
13. DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x00000000156c3328
14. DB::TCPHandler::runImpl() @ 0x0000000016a6d550
15. DB::TCPHandler::run() @ 0x0000000016a897e4
16. Poco::Net::TCPServerConnection::start() @ 0x000000001b233398
17. Poco::Net::TCPServerDispatcher::run() @ 0x000000001b233934
18. Poco::PooledThread::run() @ 0x000000001b1f98dc
19. Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001b1f7c50
20. ? @ 0x0000000000080398
21. ? @ 0x00000000000e9e9c

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions