Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Select Query Raise Error: Size of filter doesn't match size of column #63653

Closed
zhnpeng opened this issue May 11, 2024 · 2 comments · Fixed by #63722
Closed

Select Query Raise Error: Size of filter doesn't match size of column #63653

zhnpeng opened this issue May 11, 2024 · 2 comments · Fixed by #63722
Assignees
Labels
analyzer Issues and pull-requests related to new analyzer bug Confirmed user-visible misbehaviour in official release

Comments

@zhnpeng
Copy link

zhnpeng commented May 11, 2024

clickhouse version

24.3.3.102-lts

Describe what's wrong

Select Query Raise Enexpected Error: SQL Error [1002]: ClickHouse exception, code: 1002, host: localhost, port: 8123; Code: 9. DB::Exception: Size of filter (2) doesn't match size of column (1). (SIZES_OF_COLUMNS_DOESNT_MATCH) (version 24.3.3.102 (official build))

How to reproduce

CREATE DATABASE testdb

CREATE TABLE testdb.testtable (
DT Datetime,
Label1 String,
Value UInt64,
) ENGINE = MergeTree()
PARTITION BY DT
ORDER BY Label1

INSERT INTO testdb.testtable (*) Values (now(), 'app', 1);

SELECT arrayJoin([0, 1]) AS arrayIdx FROM testdb.testtable WHERE arrayIdx = 0

SQL Error [1002]: ClickHouse exception, code: 1002, host: localhost, port: 8123; Code: 9. DB::Exception: Size of filter (2) doesn't match size of column (1). (SIZES_OF_COLUMNS_DOESNT_MATCH) (version 24.3.3.102 (official build))

Exception log from /var/log/clickhouse-server/clickhouse-server.log

2024.05.11 04:36:11.228244 [ 845 ] {bf94c746-3633-445e-af05-27a4ee4676e5} <Error> executeQuery: Code: 9. DB::Exception: Size of filter (2) doesn't match size of column (1). (SIZES_OF_COLUMNS_DOESNT_MATCH) (version 24.3.3.102 (official build)) (from 172.17.0.1:64972) (in query: select arrayJoin([0, 1]) as arrayIdx from testdb.testtable where arrayIdx = 0 FORMAT TabSeparatedWithNamesAndTypes;), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000cbc851b
1. DB::Exception::Exception<unsigned long, unsigned long&>(int, FormatStringHelperImpl<std::type_identity<unsigned long>::type, std::type_identity<unsigned long&>::type>, unsigned long&&, unsigned long&) @ 0x000000000d24e658
2. DB::ColumnVector<char8_t>::filter(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, long) const @ 0x00000000114aacc4
3. DB::ColumnLowCardinality::filter(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, long) const @ 0x000000001143af46
4. DB::VirtualColumnUtils::filterBlockWithDAG(std::shared_ptr<DB::ActionsDAG>, DB::Block&, std::shared_ptr<DB::Context const>) @ 0x0000000011a4c8a3
5. DB::MergeTreeDataSelectExecutor::filterPartsByVirtualColumns(DB::MergeTreeData const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::shared_ptr<DB::ActionsDAG> const&, std::shared_ptr<DB::Context const>) @ 0x0000000011e35293
6. DB::buildIndexes(std::optional<DB::ReadFromMergeTree::Indexes>&, std::shared_ptr<DB::ActionsDAG>, DB::MergeTreeData const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::shared_ptr<DB::Context const> const&, DB::SelectQueryInfo const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&) @ 0x0000000012814f1e
7. DB::ReadFromMergeTree::applyFilters(DB::ActionDAGNodes) @ 0x0000000012814654
8. DB::QueryPlanOptimizations::optimizePrimaryKeyCondition(std::vector<DB::QueryPlanOptimizations::Frame, std::allocator<DB::QueryPlanOptimizations::Frame>> const&) @ 0x0000000012891b6e
9. DB::QueryPlanOptimizations::optimizeTreeSecondPass(DB::QueryPlanOptimizationSettings const&, DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x0000000012890815
10. DB::QueryPlan::optimize(DB::QueryPlanOptimizationSettings const&) @ 0x00000000127f4fb6
11. DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x00000000127f3e6e
12. DB::InterpreterSelectQueryAnalyzer::buildQueryPipeline() @ 0x0000000010e5310d
13. DB::InterpreterSelectQueryAnalyzer::execute() @ 0x0000000010e529fe
14. DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x000000001126e162
15. DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::shared_ptr<DB::Context>, std::function<void (DB::QueryResultDetails const&)>, DB::QueryFlags, std::optional<DB::FormatSettings> const&, std::function<void (DB::IOutputFormat&)>) @ 0x000000001127341e
16. DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::optional<DB::CurrentThread::QueryScope>&, StrongTypedef<unsigned long, ProfileEvents::EventTag> const&) @ 0x00000000122f0075
17. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&, StrongTypedef<unsigned long, ProfileEvents::EventTag> const&) @ 0x00000000122f4b34
18. DB::HTTPServerConnection::run() @ 0x00000000123740da
19. Poco::Net::TCPServerConnection::start() @ 0x0000000014c9b8d2
20. Poco::Net::TCPServerDispatcher::run() @ 0x0000000014c9c719
21. Poco::PooledThread::run() @ 0x0000000014d94e81
22. Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000014d9341d
23. ? @ 0x00007fad16c6d609
24. ? @ 0x00007fad16b92353

2024.05.11 04:36:11.228606 [ 845 ] {bf94c746-3633-445e-af05-27a4ee4676e5} <Error> DynamicQueryHandler: Code: 9. DB::Exception: Size of filter (2) doesn't match size of column (1). (SIZES_OF_COLUMNS_DOESNT_MATCH), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000cbc851b
1. DB::Exception::Exception<unsigned long, unsigned long&>(int, FormatStringHelperImpl<std::type_identity<unsigned long>::type, std::type_identity<unsigned long&>::type>, unsigned long&&, unsigned long&) @ 0x000000000d24e658
2. DB::ColumnVector<char8_t>::filter(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, long) const @ 0x00000000114aacc4
3. DB::ColumnLowCardinality::filter(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, long) const @ 0x000000001143af46
4. DB::VirtualColumnUtils::filterBlockWithDAG(std::shared_ptr<DB::ActionsDAG>, DB::Block&, std::shared_ptr<DB::Context const>) @ 0x0000000011a4c8a3
5. DB::MergeTreeDataSelectExecutor::filterPartsByVirtualColumns(DB::MergeTreeData const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::shared_ptr<DB::ActionsDAG> const&, std::shared_ptr<DB::Context const>) @ 0x0000000011e35293
6. DB::buildIndexes(std::optional<DB::ReadFromMergeTree::Indexes>&, std::shared_ptr<DB::ActionsDAG>, DB::MergeTreeData const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::shared_ptr<DB::Context const> const&, DB::SelectQueryInfo const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&) @ 0x0000000012814f1e
7. DB::ReadFromMergeTree::applyFilters(DB::ActionDAGNodes) @ 0x0000000012814654
8. DB::QueryPlanOptimizations::optimizePrimaryKeyCondition(std::vector<DB::QueryPlanOptimizations::Frame, std::allocator<DB::QueryPlanOptimizations::Frame>> const&) @ 0x0000000012891b6e
9. DB::QueryPlanOptimizations::optimizeTreeSecondPass(DB::QueryPlanOptimizationSettings const&, DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x0000000012890815
10. DB::QueryPlan::optimize(DB::QueryPlanOptimizationSettings const&) @ 0x00000000127f4fb6
11. DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x00000000127f3e6e
12. DB::InterpreterSelectQueryAnalyzer::buildQueryPipeline() @ 0x0000000010e5310d
13. DB::InterpreterSelectQueryAnalyzer::execute() @ 0x0000000010e529fe
14. DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x000000001126e162
15. DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::shared_ptr<DB::Context>, std::function<void (DB::QueryResultDetails const&)>, DB::QueryFlags, std::optional<DB::FormatSettings> const&, std::function<void (DB::IOutputFormat&)>) @ 0x000000001127341e
16. DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::optional<DB::CurrentThread::QueryScope>&, StrongTypedef<unsigned long, ProfileEvents::EventTag> const&) @ 0x00000000122f0075
17. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&, StrongTypedef<unsigned long, ProfileEvents::EventTag> const&) @ 0x00000000122f4b34
18. DB::HTTPServerConnection::run() @ 0x00000000123740da
19. Poco::Net::TCPServerConnection::start() @ 0x0000000014c9b8d2
20. Poco::Net::TCPServerDispatcher::run() @ 0x0000000014c9c719
21. Poco::PooledThread::run() @ 0x0000000014d94e81
22. Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000014d9341d
23. ? @ 0x00007fad16c6d609
24. ? @ 0x00007fad16b92353
 (version 24.3.3.102 (official build))

Additional context

The select query work fine at version 22.3.6.5, We want upgrade clickhouse from 22.3.6.5 to newest LTS version 24.3.3.102, and meet this error.

@zhnpeng zhnpeng added the potential bug To be reviewed by developers and confirmed/rejected. label May 11, 2024
@alexey-milovidov
Copy link
Member

@alexey-milovidov alexey-milovidov added bug Confirmed user-visible misbehaviour in official release analyzer Issues and pull-requests related to new analyzer and removed potential bug To be reviewed by developers and confirmed/rejected. labels May 12, 2024
@KochetovNicolai
Copy link
Member

Fails with old analyzer as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer Issues and pull-requests related to new analyzer bug Confirmed user-visible misbehaviour in official release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants