{"action":"closed","issue":{"url":"https://api.github.com/repos/yandex/ClickHouse/issues/3221","repository_url":"https://api.github.com/repos/yandex/ClickHouse","labels_url":"https://api.github.com/repos/yandex/ClickHouse/issues/3221/labels{/name}","comments_url":"https://api.github.com/repos/yandex/ClickHouse/issues/3221/comments","events_url":"https://api.github.com/repos/yandex/ClickHouse/issues/3221/events","html_url":"https://github.com/yandex/ClickHouse/issues/3221","id":363953543,"node_id":"MDU6SXNzdWUzNjM5NTM1NDM=","number":3221,"title":"multiIf with Decimal crash server","user":{"login":"e11it","id":2675172,"node_id":"MDQ6VXNlcjI2NzUxNzI=","avatar_url":"https://avatars0.githubusercontent.com/u/2675172?v=4","gravatar_id":"","url":"https://api.github.com/users/e11it","html_url":"https://github.com/e11it","followers_url":"https://api.github.com/users/e11it/followers","following_url":"https://api.github.com/users/e11it/following{/other_user}","gists_url":"https://api.github.com/users/e11it/gists{/gist_id}","starred_url":"https://api.github.com/users/e11it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e11it/subscriptions","organizations_url":"https://api.github.com/users/e11it/orgs","repos_url":"https://api.github.com/users/e11it/repos","events_url":"https://api.github.com/users/e11it/events{/privacy}","received_events_url":"https://api.github.com/users/e11it/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"4ertus2","id":8061274,"node_id":"MDQ6VXNlcjgwNjEyNzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/8061274?v=4","gravatar_id":"","url":"https://api.github.com/users/4ertus2","html_url":"https://github.com/4ertus2","followers_url":"https://api.github.com/users/4ertus2/followers","following_url":"https://api.github.com/users/4ertus2/following{/other_user}","gists_url":"https://api.github.com/users/4ertus2/gists{/gist_id}","starred_url":"https://api.github.com/users/4ertus2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/4ertus2/subscriptions","organizations_url":"https://api.github.com/users/4ertus2/orgs","repos_url":"https://api.github.com/users/4ertus2/repos","events_url":"https://api.github.com/users/4ertus2/events{/privacy}","received_events_url":"https://api.github.com/users/4ertus2/received_events","type":"User","site_admin":false},"assignees":[{"login":"4ertus2","id":8061274,"node_id":"MDQ6VXNlcjgwNjEyNzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/8061274?v=4","gravatar_id":"","url":"https://api.github.com/users/4ertus2","html_url":"https://github.com/4ertus2","followers_url":"https://api.github.com/users/4ertus2/followers","following_url":"https://api.github.com/users/4ertus2/following{/other_user}","gists_url":"https://api.github.com/users/4ertus2/gists{/gist_id}","starred_url":"https://api.github.com/users/4ertus2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/4ertus2/subscriptions","organizations_url":"https://api.github.com/users/4ertus2/orgs","repos_url":"https://api.github.com/users/4ertus2/repos","events_url":"https://api.github.com/users/4ertus2/events{/privacy}","received_events_url":"https://api.github.com/users/4ertus2/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-09-26T10:14:20Z","updated_at":"2018-09-26T12:14:35Z","closed_at":"2018-09-26T12:14:35Z","author_association":"NONE","body":"Привет!\r\n\r\nСервер КХ падает, если выполнить этот запрос:\r\n\r\n```\r\nSELECT multiIf(toDecimal64(0, 4) = 0, NULL, toDecimal64(0, 4) / 0)\r\n\r\nException on client:\r\nCode: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000, 127.0.0.1\r\n```\r\n\r\nВ логе:\r\n\r\n```\r\n2018.09.26 13:06:27.834574 [ 2 ] <Error> BaseDaemon: ########################################\r\n2018.09.26 13:06:27.834701 [ 2 ] <Error> BaseDaemon: (from thread 26) Received signal Floating point exception (8).\r\n2018.09.26 13:06:27.834720 [ 2 ] <Error> BaseDaemon: Integer divide by zero.\r\n2018.09.26 13:06:27.891521 [ 2 ] <Error> BaseDaemon: 0. clickhouse-server() [0x3e25b89]\r\n2018.09.26 13:06:27.891582 [ 2 ] <Error> BaseDaemon: 1. clickhouse-server(DB::FunctionBinaryArithmetic<DB::DivideFloatingImpl, DB::NameDivideFloating, true>::executeImpl(DB::Bloc\r\nk&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long)+0x1cdf) [0x3e2b17f]\r\n2018.09.26 13:06:27.891602 [ 2 ] <Error> BaseDaemon: 2. clickhouse-server(DB::PreparedFunctionImpl::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> >\r\n const&, unsigned long, unsigned long)+0x930) [0x4de26c0]\r\n2018.09.26 13:06:27.891613 [ 2 ] <Error> BaseDaemon: 3. clickhouse-server(DB::IFunctionBase::execute(DB::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&\r\n, unsigned long, unsigned long)+0x41) [0x2b5a701]\r\n2018.09.26 13:06:27.891634 [ 2 ] <Error> BaseDaemon: 4. clickhouse-server(DB::ExpressionAction::prepare(DB::Block&)+0x70a) [0x4f0792a]\r\n2018.09.26 13:06:27.891690 [ 2 ] <Error> BaseDaemon: 5. clickhouse-server(DB::ExpressionActions::addImpl(DB::ExpressionAction, std::vector<std::string, std::allocator<std::string\r\n> >&)+0x6a) [0x4f100ca]\r\n2018.09.26 13:06:27.891711 [ 2 ] <Error> BaseDaemon: 6. clickhouse-server(DB::ExpressionActions::add(DB::ExpressionAction const&, std::vector<std::string, std::allocator<std::str\r\ning> >&)+0x32) [0x4f10562]\r\n2018.09.26 13:06:27.891721 [ 2 ] <Error> BaseDaemon: 7. clickhouse-server(DB::ScopeStack::addAction(DB::ExpressionAction const&)+0xa5) [0x4f1a385]\r\n2018.09.26 13:06:27.891731 [ 2 ] <Error> BaseDaemon: 8. clickhouse-server(DB::ExpressionAnalyzer::getActionsImpl(std::shared_ptr<DB::IAST> const&, bool, bool, DB::ScopeStack&, st\r\nd::shared_ptr<DB::ProjectionManipulatorBase>)+0x1814) [0x4f224c4]\r\n2018.09.26 13:06:27.891740 [ 2 ] <Error> BaseDaemon: 9. clickhouse-server(DB::ExpressionAnalyzer::getActionsImpl(std::shared_ptr<DB::IAST> const&, bool, bool, DB::ScopeStack&, st\r\nd::shared_ptr<DB::ProjectionManipulatorBase>)+0x1342) [0x4f21ff2]\r\n2018.09.26 13:06:27.891749 [ 2 ] <Error> BaseDaemon: 10. clickhouse-server(DB::ExpressionAnalyzer::getActionsImpl(std::shared_ptr<DB::IAST> const&, bool, bool, DB::ScopeStack&, s\r\ntd::shared_ptr<DB::ProjectionManipulatorBase>)+0x146c) [0x4f2211c]\r\n2018.09.26 13:06:27.891758 [ 2 ] <Error> BaseDaemon: 11. clickhouse-server(DB::ExpressionAnalyzer::getRootActions(std::shared_ptr<DB::IAST> const&, bool, bool, std::shared_ptr<DB\r\n::ExpressionActions>&)+0xc4) [0x4f23b74]\r\n2018.09.26 13:06:27.891766 [ 2 ] <Error> BaseDaemon: 12. clickhouse-server(DB::ExpressionAnalyzer::appendSelect(DB::ExpressionActionsChain&, bool)+0x52) [0x4f24842]\r\n2018.09.26 13:06:27.891778 [ 2 ] <Error> BaseDaemon: 13. clickhouse-server(DB::InterpreterSelectQuery::analyzeExpressions(DB::QueryProcessingStage::Enum, bool)+0x3d8) [0x4aea8c8]\r\n2018.09.26 13:06:27.891787 [ 2 ] <Error> BaseDaemon: 14. clickhouse-server(DB::InterpreterSelectQuery::executeImpl(DB::InterpreterSelectQuery::Pipeline&, std::shared_ptr<DB::IBlo\r\nckInputStream> const&, bool)+0x649) [0x4aef459]\r\n2018.09.26 13:06:27.891808 [ 2 ] <Error> BaseDaemon: 15. clickhouse-server(DB::InterpreterSelectQuery::InterpreterSelectQuery(std::shared_ptr<DB::IAST> const&, DB::Context const&\r\n, std::shared_ptr<DB::IBlockInputStream> const&, std::shared_ptr<DB::IStorage> const&, std::vector<std::string, std::allocator<std::string> > const&, DB::QueryProcessingStage::En\r\num, unsigned long, bool)+0x65c) [0x4af096c]\r\n2018.09.26 13:06:27.891820 [ 2 ] <Error> BaseDaemon: 16. clickhouse-server(DB::InterpreterSelectQuery::InterpreterSelectQuery(std::shared_ptr<DB::IAST> const&, DB::Context const&\r\n, std::vector<std::string, std::allocator<std::string> > const&, DB::QueryProcessingStage::Enum, unsigned long, bool)+0x42) [0x4af1742]\r\n2018.09.26 13:06:27.891830 [ 2 ] <Error> BaseDaemon: 17. clickhouse-server(DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::shared_ptr<DB::IAST> const&,\r\nDB::Context const&, std::vector<std::string, std::allocator<std::string> > const&, DB::QueryProcessingStage::Enum, unsigned long, bool)+0x6ba) [0x4afd4aa]\r\n2018.09.26 13:06:27.891839 [ 2 ] <Error> BaseDaemon: 18. clickhouse-server(DB::InterpreterFactory::get(std::shared_ptr<DB::IAST>&, DB::Context&, DB::QueryProcessingStage::Enum)+0\r\nx1f4) [0x4ad9ec4]\r\n2018.09.26 13:06:27.891846 [ 2 ] <Error> BaseDaemon: 19. clickhouse-server() [0x4b792e7]\r\n2018.09.26 13:06:27.891855 [ 2 ] <Error> BaseDaemon: 20. clickhouse-server(DB::executeQuery(std::string const&, DB::Context&, bool, DB::QueryProcessingStage::Enum)+0x70) [0x4b7b1\r\n00]\r\n2018.09.26 13:06:27.891863 [ 2 ] <Error> BaseDaemon: 21. clickhouse-server(DB::TCPHandler::runImpl()+0x4a6) [0x29551b6]\r\n2018.09.26 13:06:27.891870 [ 2 ] <Error> BaseDaemon: 22. clickhouse-server(DB::TCPHandler::run()+0x1c) [0x295649c]\r\n2018.09.26 13:06:27.891878 [ 2 ] <Error> BaseDaemon: 23. clickhouse-server(Poco::Net::TCPServerConnection::start()+0xf) [0x526ec3f]\r\n2018.09.26 13:06:27.891885 [ 2 ] <Error> BaseDaemon: 24. clickhouse-server(Poco::Net::TCPServerDispatcher::run()+0x110) [0x526f2a0]\r\n2018.09.26 13:06:27.891892 [ 2 ] <Error> BaseDaemon: 25. clickhouse-server(Poco::PooledThread::run()+0x77) [0x5324937]\r\n2018.09.26 13:06:27.891910 [ 2 ] <Error> BaseDaemon: 27. clickhouse-server() [0x587bc6f]\r\n2018.09.26 13:06:27.891918 [ 2 ] <Error> BaseDaemon: 28. /lib64/libpthread.so.0(+0x7dd5) [0x7f6378192dd5]\r\n```\r\n\r\nА вот так, работает нормально:\r\n\r\n```sql\r\nSELECT multiIf(0 = 0, NULL, 0 / 0)\r\n\r\n┌─multiIf(equals(0, 0), NULL, divide(0, 0))─┐\r\n│                                      ᴺᵁᴸᴸ │\r\n└───────────────────────────────────────────┘\r\n\r\n1 rows in set. Elapsed: 0.003 sec.\r\n```"}}
{"actor":{"display_login":"4ertus2"}}