Skip to content

Analyzer: Logical error: 'Cannot find column c0 in minmax_count projection but query analysis still selects this projection. It's a bug'. #48068

@qoega

Description

@qoega

https://s3.amazonaws.com/clickhouse-test-reports/0/556680966f17b539847060d00f0107fac69c83ad/sqlancer__debug_.html

2023.03.27 16:20:56.822493 [ 53 ] {} <Trace> DynamicQueryHandler: Request URI: /?compress=1&extremes=0&query_id=baa4e60c-c209-40dc-996b-1eb1b9522bf6
2023.03.27 16:20:56.836502 [ 53 ] {baa4e60c-c209-40dc-996b-1eb1b9522bf6} <Debug> executeQuery: (from 127.0.0.1:44784) SELECT (- ((((tan (t1.c0)))+(t1.c0)))), (cos ((sin (pow(t1.c0,t1.c0))))), ((gcd((- (t1.c0)),((t1.c0)+(t1.c0))))*((- ((- (t1.c0)))))) FROM t1 GROUP BY (sqrt ((- (t1.c0)))), t1.c0, pow((erf ((- (t1.c0)))),t1.c0) (stage: Complete)
2023.03.27 16:20:56.847195 [ 53 ] {baa4e60c-c209-40dc-996b-1eb1b9522bf6} <Trace> ContextAccess (default): Access granted: SELECT(c0) ON database7TLPGroupBy.t1
2023.03.27 16:20:56.847860 [ 53 ] {baa4e60c-c209-40dc-996b-1eb1b9522bf6} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
2023.03.27 16:20:56.863555 [ 53 ] {baa4e60c-c209-40dc-996b-1eb1b9522bf6} <Fatal> : Logical error: 'Cannot find column c0 in minmax_count projection but query analysis still selects this projection. It's a bug'.
2023.03.27 16:20:56.864612 [ 442 ] {} <Fatal> BaseDaemon: (version 23.3.1.1 (official build), build id: D5BCCED898CCA6006D86AA48C9B624F124E4FF05) (from thread 53) (query_id: baa4e60c-c209-40dc-996b-1eb1b9522bf6) (query: SELECT (- ((((tan (t1.c0)))+(t1.c0)))), (cos ((sin (pow(t1.c0,t1.c0))))), ((gcd((- (t1.c0)),((t1.c0)+(t1.c0))))*((- ((- (t1.c0)))))) FROM t1 GROUP BY (sqrt ((- (t1.c0)))), t1.c0, pow((erf ((- (t1.c0)))),t1.c0)) Received signal Aborted (6)
2023.03.27 16:20:56.863555 [ 53 ] {baa4e60c-c209-40dc-996b-1eb1b9522bf6} <Fatal> : Logical error: 'Cannot find column c0 in minmax_count projection but query analysis still selects this projection. It's a bug'.
2023.03.27 16:20:56.864450 [ 442 ] {} <Fatal> BaseDaemon: ########################################
2023.03.27 16:20:56.864612 [ 442 ] {} <Fatal> BaseDaemon: (version 23.3.1.1 (official build), build id: D5BCCED898CCA6006D86AA48C9B624F124E4FF05) (from thread 53) (query_id: baa4e60c-c209-40dc-996b-1eb1b9522bf6) (query: SELECT (- ((((tan (t1.c0)))+(t1.c0)))), (cos ((sin (pow(t1.c0,t1.c0))))), ((gcd((- (t1.c0)),((t1.c0)+(t1.c0))))*((- ((- (t1.c0)))))) FROM t1 GROUP BY (sqrt ((- (t1.c0)))), t1.c0, pow((erf ((- (t1.c0)))),t1.c0)) Received signal Aborted (6)
2023.03.27 16:20:56.864922 [ 442 ] {} <Fatal> BaseDaemon:
2023.03.27 16:20:56.865065 [ 442 ] {} <Fatal> BaseDaemon: Stack trace: 0x7f9ca1defa7c 0x7f9ca1d9b476 0x7f9ca1d817f3 0x21c27fb6 0x21c28035 0x21c2843f 0x1923db4a 0x19973ff3 0x2b765078 0x2c60e12c 0x2c60ecde 0x2c5cf305 0x2c52571d 0x2c525217 0x2a4fd28b 0x2a9bdbf7 0x2a9c26ad 0x2bd61b16 0x2bd64567 0x2be011dc 0x3127b9d9 0x3127c21c 0x314cc814 0x314c95ba 0x314c82be 0x7f9ca1dedb43 0x7f9ca1e7fa00
2023.03.27 16:20:56.865211 [ 442 ] {} <Fatal> BaseDaemon: 4. pthread_kill @ 0x7f9ca1defa7c in ?
2023.03.27 16:20:56.865448 [ 442 ] {} <Fatal> BaseDaemon: 5. raise @ 0x7f9ca1d9b476 in ?
2023.03.27 16:20:56.865578 [ 442 ] {} <Fatal> BaseDaemon: 6. abort @ 0x7f9ca1d817f3 in ?
2023.03.27 16:20:57.071095 [ 442 ] {} <Fatal> BaseDaemon: 7. /build/build_docker/../src/Common/Exception.cpp:41: DB::abortOnFailedAssertion(String const&) @ 0x21c27fb6 in /clickhouse
2023.03.27 16:20:57.249226 [ 442 ] {} <Fatal> BaseDaemon: 8. /build/build_docker/../src/Common/Exception.cpp:64: DB::handle_error_code(String const&, int, bool, std::vector<void*, std::allocator<void*>> const&) @ 0x21c28035 in /clickhouse
2023.03.27 16:20:57.427986 [ 442 ] {} <Fatal> BaseDaemon: 9. /build/build_docker/../src/Common/Exception.cpp:92: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x21c2843f in /clickhouse
2023.03.27 16:20:57.580613 [ 442 ] {} <Fatal> BaseDaemon: 10. /build/build_docker/../src/Common/Exception.h:55: DB::Exception::Exception(String&&, int, bool) @ 0x1923db4a in /clickhouse
2023.03.27 16:20:57.746426 [ 442 ] {} <Fatal> BaseDaemon: 11. /build/build_docker/../src/Common/Exception.h:82: DB::Exception::Exception<String const&>(int, FormatStringHelperImpl<std::type_identity<String const&>::type>, String const&) @ 0x19973ff3 in /clickhouse
2023.03.27 16:20:59.620509 [ 442 ] {} <Fatal> BaseDaemon: 12. /build/build_docker/../src/Storages/MergeTree/MergeTreeData.cpp:6433: DB::MergeTreeData::getMinMaxCountProjectionBlock(std::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::vector<String, std::allocator<String>> const&, bool, DB::SelectQueryInfo const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>>&, std::unordered_map<String, long, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, long>>> const*, std::shared_ptr<DB::Context const>) const @ 0x2b765078 in /clickhouse
2023.03.27 16:21:00.199048 [ 442 ] {} <Fatal> BaseDaemon: 13. /build/build_docker/../src/Processors/QueryPlan/Optimizations/optimizeUseAggregateProjection.cpp:440: DB::QueryPlanOptimizations::getAggregateProjectionCandidates(DB::QueryPlan::Node&, DB::AggregatingStep&, DB::ReadFromMergeTree&, std::shared_ptr<std::unordered_map<String, long, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, long>>>> const&) @ 0x2c60e12c in /clickhouse
2023.03.27 16:21:00.803102 [ 442 ] {} <Fatal> BaseDaemon: 14. /build/build_docker/../src/Processors/QueryPlan/Optimizations/optimizeUseAggregateProjection.cpp:525: DB::QueryPlanOptimizations::optimizeUseAggregateProjections(DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x2c60ecde in /clickhouse
2023.03.27 16:21:00.935209 [ 442 ] {} <Fatal> BaseDaemon: 15. /build/build_docker/../src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:127: DB::QueryPlanOptimizations::optimizeTreeSecondPass(DB::QueryPlanOptimizationSettings const&, DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x2c5cf305 in /clickhouse
2023.03.27 16:21:01.234199 [ 442 ] {} <Fatal> BaseDaemon: 16. /build/build_docker/../src/Processors/QueryPlan/QueryPlan.cpp:465: DB::QueryPlan::optimize(DB::QueryPlanOptimizationSettings const&) @ 0x2c52571d in /clickhouse
2023.03.27 16:21:01.532994 [ 442 ] {} <Fatal> BaseDaemon: 17. /build/build_docker/../src/Processors/QueryPlan/QueryPlan.cpp:167: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x2c525217 in /clickhouse
2023.03.27 16:21:01.937464 [ 442 ] {} <Fatal> BaseDaemon: 18. /build/build_docker/../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:379: DB::InterpreterSelectWithUnionQuery::execute() @ 0x2a4fd28b in /clickhouse
2023.03.27 16:21:02.299670 [ 442 ] {} <Fatal> BaseDaemon: 19. /build/build_docker/../src/Interpreters/executeQuery.cpp:713: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x2a9bdbf7 in /clickhouse
2023.03.27 16:21:02.722516 [ 442 ] {} <Fatal> BaseDaemon: 20. /build/build_docker/../src/Interpreters/executeQuery.cpp:1229: DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::shared_ptr<DB::Context>, std::function<void (DB::QueryResultDetails const&)>, std::optional<DB::FormatSettings> const&) @ 0x2a9c26ad in /clickhouse
2023.03.27 16:21:03.092500 [ 442 ] {} <Fatal> BaseDaemon: 21. /build/build_docker/../src/Server/HTTPHandler.cpp:838: DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::optional<DB::CurrentThread::QueryScope>&) @ 0x2bd61b16 in /clickhouse
2023.03.27 16:21:03.392380 [ 442 ] {} <Fatal> BaseDaemon: 22. /build/build_docker/../src/Server/HTTPHandler.cpp:1033: DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) @ 0x2bd64567 in /clickhouse
2023.03.27 16:21:03.438585 [ 442 ] {} <Fatal> BaseDaemon: 23. /build/build_docker/../src/Server/HTTP/HTTPServerConnection.cpp:68: DB::HTTPServerConnection::run() @ 0x2be011dc in /clickhouse
2023.03.27 16:21:03.477872 [ 442 ] {} <Fatal> BaseDaemon: 24. /build/build_docker/../base/poco/Net/src/TCPServerConnection.cpp:43: Poco::Net::TCPServerConnection::start() @ 0x3127b9d9 in /clickhouse
2023.03.27 16:21:03.529028 [ 442 ] {} <Fatal> BaseDaemon: 25. /build/build_docker/../base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x3127c21c in /clickhouse
2023.03.27 16:21:03.588778 [ 442 ] {} <Fatal> BaseDaemon: 26. /build/build_docker/../base/poco/Foundation/src/ThreadPool.cpp:188: Poco::PooledThread::run() @ 0x314cc814 in /clickhouse
2023.03.27 16:21:03.644909 [ 442 ] {} <Fatal> BaseDaemon: 27. /build/build_docker/../base/poco/Foundation/src/Thread.cpp:46: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x314c95ba in /clickhouse
2023.03.27 16:21:03.699028 [ 442 ] {} <Fatal> BaseDaemon: 28. /build/build_docker/../base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x314c82be in /clickhouse
2023.03.27 16:21:03.699266 [ 442 ] {} <Fatal> BaseDaemon: 29. ? @ 0x7f9ca1dedb43 in ?
2023.03.27 16:21:03.699439 [ 442 ] {} <Fatal> BaseDaemon: 30. ? @ 0x7f9ca1e7fa00 in ?
2023.03.27 16:21:05.485447 [ 442 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: AA5D4874CC30115D931057B006C36821)
DROP DATABASE IF EXISTS database3TLPGroupBy;
CREATE DATABASE IF NOT EXISTS database3TLPGroupBy;
USE database3TLPGroupBy;
CREATE TABLE IF NOT EXISTS database3TLPGroupBy.t0 (c0 String) ENGINE = Memory() ;
CREATE TABLE database3TLPGroupBy.t1 (c0 String) ENGINE = Memory() ;
CREATE TABLE IF NOT EXISTS database3TLPGroupBy.t2 (c0 String) ENGINE = Log() ;
CREATE TABLE database3TLPGroupBy.t3 (c0 Int32) ENGINE = Log() ;
CREATE TABLE database3TLPGroupBy.t4 (c0 String) ENGINE = Memory() ;
INSERT INTO t2(c0) VALUES ('zL');
INSERT INTO t0(c0) VALUES ('* RbGr');
INSERT INTO t2(c0) VALUES ('9P	9d');
INSERT INTO t2(c0) VALUES ('Osc?9*)'), ('');
INSERT INTO t4(c0) VALUES ('-585625451');
INSERT INTO t1(c0) VALUES ('Lstl');
INSERT INTO t0(c0) VALUES ('');
INSERT INTO t2(c0) VALUES ('-1174021174'), ('y	.aq|');
INSERT INTO t4(c0) VALUES ('A???\r)F'), ('_gO&C?'), ('7iS');
INSERT INTO t0(c0) VALUES ('OQ'), ('kt+');
INSERT INTO t1(c0) VALUES ('');
INSERT INTO t2(c0) VALUES ('');
INSERT INTO t4(c0) VALUES ('');

SELECT (- ((((tan (t1.c0)))+(t1.c0)))), (cos ((sin (pow(t1.c0,t1.c0))))), ((gcd((- (t1.c0)),((t1.c0)+(t1.c0))))*((- ((- (t1.c0)))))) FROM t1 GROUP BY (sqrt ((- (t1.c0)))), t1.c0, pow((erf ((- (t1.c0)))),t1.c0) SETTINGS allow_experimental_analyzer=1;

cc: @kitaisreal

Metadata

Metadata

Labels

bug-unreleasedBug that affects unreleased or experimental codefuzzProblem found by one of the fuzzerssqlancerIssue found by SQLancer tool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions