{"action":"created","issue":{"url":"https://api.github.com/repos/yandex/ClickHouse/issues/1125","repository_url":"https://api.github.com/repos/yandex/ClickHouse","labels_url":"https://api.github.com/repos/yandex/ClickHouse/issues/1125/labels{/name}","comments_url":"https://api.github.com/repos/yandex/ClickHouse/issues/1125/comments","events_url":"https://api.github.com/repos/yandex/ClickHouse/issues/1125/events","html_url":"https://github.com/yandex/ClickHouse/issues/1125","id":251475533,"node_id":"MDU6SXNzdWUyNTE0NzU1MzM=","number":1125,"title":"segmentation fault on inner join and dict","user":{"login":"inkrement","id":604528,"node_id":"MDQ6VXNlcjYwNDUyOA==","avatar_url":"https://avatars3.githubusercontent.com/u/604528?v=4","gravatar_id":"","url":"https://api.github.com/users/inkrement","html_url":"https://github.com/inkrement","followers_url":"https://api.github.com/users/inkrement/followers","following_url":"https://api.github.com/users/inkrement/following{/other_user}","gists_url":"https://api.github.com/users/inkrement/gists{/gist_id}","starred_url":"https://api.github.com/users/inkrement/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inkrement/subscriptions","organizations_url":"https://api.github.com/users/inkrement/orgs","repos_url":"https://api.github.com/users/inkrement/repos","events_url":"https://api.github.com/users/inkrement/events{/privacy}","received_events_url":"https://api.github.com/users/inkrement/received_events","type":"User","site_admin":false},"labels":[{"id":386401505,"node_id":"MDU6TGFiZWwzODY0MDE1MDU=","url":"https://api.github.com/repos/yandex/ClickHouse/labels/bug","name":"bug","color":"ee0701","default":true},{"id":845267693,"node_id":"MDU6TGFiZWw4NDUyNjc2OTM=","url":"https://api.github.com/repos/yandex/ClickHouse/labels/need%20info","name":"need info","color":"e5b890","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-20T08:49:20Z","updated_at":"2018-07-29T14:07:05Z","closed_at":"2018-07-29T14:07:05Z","author_association":"NONE","body":"I tried to join two tables like this:\r\n```sql\r\nCREATE TABLE comments_videos ENGINE=MergeTree(date,(video_id, date), 8192) AS SELECT video_id,\r\n       date,\r\n       dictGetString('video','channel_id',tuple(toString(video_id))) AS channel_id,\r\n       dictGetInt16('video','isRed',tuple(toString(video_id))) AS isRed,\r\n       sentiment\r\n  FROM comments_basic ANY\r\n INNER JOIN comments_sentiment USING uuid\r\n```\r\n\r\nTable 1 (comments_basic)\r\nRows: ~ 1 403m\r\n```sql\r\nCREATE MATERIALIZED VIEW yt.comments_basic ( uuid FixedString(36),  date Date,  video_id FixedString(33),  likeCount UInt16) ENGINE = MergeTree(date, (uuid, date), 8192) AS SELECT toFixedString(UUIDNumToString(id), 36) AS uuid, date, video_id, likeCount FROM yt.comments\r\n```\r\n\r\nTable 2 (comments_sentiment)\r\nRows: ~780m \r\n```sql\r\nCREATE MATERIALIZED VIEW yt.comments_sentiment ( const_date Date,  uuid FixedString(36),  sentiment Int16) ENGINE = MergeTree(const_date, (uuid, const_date), 8192) AS SELECT toDate(now()) AS const_date, uuid, if(sentiment = '__label__pos', 1, if(sentiment = '__label__neg', -1, 0)) AS sentiment FROM yt.comments_sentiment_raw\r\n```\r\n\r\nBut got an unexpected (but reproducible) result. Interesting fact: I was already able to run it successfully, but just changed the name of field `const_date` from `date` to `const_date`, because I wanted to pick the date value of table `comments_basic` and it from the other table otherwise.\r\n```log\r\n2017.08.20 10:33:41.608772 [ 571 ] <Error> BaseDaemon: ########################################\r\n2017.08.20 10:33:41.608878 [ 571 ] <Error> BaseDaemon: (from thread 7) Received signal Segmentation fault (11).\r\n2017.08.20 10:33:41.608900 [ 571 ] <Error> BaseDaemon: Address: 0xf8\r\n2017.08.20 10:33:41.678843 [ 571 ] <Error> BaseDaemon: 0. clickhouse-server(DB::LogBlockOutputStream::writeData(std::string const&, DB::IDataType const&, DB::IColumn const&, std::vector<std::pair<unsigned long, DB::Mark>, std::allocator<std::pair<unsigned long, DB::Mark> > >&, std::vector<std::pair<unsigned long, DB::Mark>, std::allocator<std::pair<unsigned long, DB::Mark> > >&, std::set<std::string, std::less<std::string>, std::allocator<std::string> >&, unsigned long)+0x505) [0x2a87965]\r\n2017.08.20 10:33:41.678873 [ 571 ] <Error> BaseDaemon: 1. clickhouse-server(DB::LogBlockOutputStream::write(DB::Block const&)+0x120) [0x2a881e0]\r\n2017.08.20 10:33:41.678891 [ 571 ] <Error> BaseDaemon: 2. clickhouse-server(DB::PushingToViewsBlockOutputStream::write(DB::Block const&)+0x445) [0x2907f55]\r\n2017.08.20 10:33:41.678910 [ 571 ] <Error> BaseDaemon: 3. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x91) [0x2cf5f51]\r\n2017.08.20 10:33:41.678927 [ 571 ] <Error> BaseDaemon: 4. clickhouse-server(DB::PushingToViewsBlockOutputStream::write(DB::Block const&)+0x3f1) [0x2907f01]\r\n2017.08.20 10:33:41.678943 [ 571 ] <Error> BaseDaemon: 5. clickhouse-server(DB::MaterializingBlockOutputStream::write(DB::Block const&)+0x28) [0x2905728]\r\n2017.08.20 10:33:41.678958 [ 571 ] <Error> BaseDaemon: 6. clickhouse-server(DB::AddingDefaultBlockOutputStream::write(DB::Block const&)+0x235) [0x2c1ab25]\r\n2017.08.20 10:33:41.678974 [ 571 ] <Error> BaseDaemon: 7. clickhouse-server(DB::ProhibitColumnsBlockOutputStream::write(DB::Block const&)+0x4f) [0x2cbf22f]\r\n2017.08.20 10:33:41.678991 [ 571 ] <Error> BaseDaemon: 8. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x91) [0x2cf5f51]\r\n2017.08.20 10:33:41.679008 [ 571 ] <Error> BaseDaemon: 9. clickhouse-server(DB::NullAndDoCopyBlockInputStream::readImpl()+0x24) [0x2903e34]\r\n2017.08.20 10:33:41.679023 [ 571 ] <Error> BaseDaemon: 10. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x22f9216]\r\n2017.08.20 10:33:41.679053 [ 571 ] <Error> BaseDaemon: 11. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x5c) [0x2cf5f1c]\r\n2017.08.20 10:33:41.679076 [ 571 ] <Error> BaseDaemon: 12. clickhouse-server(DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, DB::Context&, std::function<void (std::string const&)>)+0x58b) [0x29a5a6b]\r\n2017.08.20 10:33:41.679096 [ 571 ] <Error> BaseDaemon: 13. clickhouse-server(DB::HTTPHandler::processQuery(Poco::Net::HTTPServerRequest&, HTMLForm&, Poco::Net::HTTPServerResponse&, DB::HTTPHandler::Output&)+0x1e19) [0x1014449]\r\n2017.08.20 10:33:41.679130 [ 571 ] <Error> BaseDaemon: 14. clickhouse-server(DB::HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest&, Poco::Net::HTTPServerResponse&)+0x336) [0x10166e6]\r\n2017.08.20 10:33:41.679146 [ 571 ] <Error> BaseDaemon: 15. clickhouse-server(Poco::Net::HTTPServerConnection::run()+0x253) [0x32054d3]\r\n2017.08.20 10:33:41.679161 [ 571 ] <Error> BaseDaemon: 16. clickhouse-server(Poco::Net::TCPServerConnection::start()+0xf) [0x31feb5f]\r\n2017.08.20 10:33:41.679176 [ 571 ] <Error> BaseDaemon: 17. clickhouse-server(Poco::Net::TCPServerDispatcher::run()+0x10b) [0x320036b]\r\n2017.08.20 10:33:41.679192 [ 571 ] <Error> BaseDaemon: 18. clickhouse-server(Poco::PooledThread::run()+0x87) [0x3306737]\r\n2017.08.20 10:33:41.679207 [ 571 ] <Error> BaseDaemon: 19. clickhouse-server(Poco::ThreadImpl::runnableEntry(void*)+0x96) [0x33012c6]\r\n2017.08.20 10:33:41.679220 [ 571 ] <Error> BaseDaemon: 20. /lib64/libpthread.so.0(+0x7dc5) [0x7ff3b6f8fdc5]\r\n```\r\n\r\n**EDIT**: I just rewrote it to use dictionaries instead of joins (it is a complex hashed external dict with the table as source)\r\n\r\n```sql\r\nCREATE TABLE comments_videos ENGINE=MergeTree(date,(video_id, date), 8192) AS SELECT video_id,\r\n       date,\r\n       dictGetString('video','channel_id',tuple(toString(video_id))) AS channel_id,\r\n       dictGetInt16('video','isRed',tuple(toString(video_id))) AS isRed,\r\n       dictGetInt16('comments_sentiment', 'sentiment', tuple(toString(uuid))) AS sentiment\r\n  FROM comments_basic\r\n```\r\n\r\n And I get a similar same exception:\r\n\r\n```\r\n2017.08.20 11:25:48.312103 [ 25 ] <Error> BaseDaemon: (from thread 24) Received signal Segmentation fault (11).\r\n2017.08.20 11:25:48.312142 [ 25 ] <Error> BaseDaemon: Address: 0xf8\r\n2017.08.20 11:25:48.366136 [ 25 ] <Error> BaseDaemon: 0. clickhouse-server(DB::LogBlockOutputStream::writeData(std::string const&, DB::IDataType const&, DB::IColumn const&, std::vector<std::pair<unsigned long, DB::Mark>, std::allocator<std::pair<unsigned long, DB::Mark> > >&, std::vector<std::pair<unsigned long, DB::Mark>, std::allocator<std::pair<unsigned long, DB::Mark> > >&, std::set<std::string, std::less<std::string>, std::allocator<std::string> >&, unsigned long)+0x505) [0x2a87965]\r\n2017.08.20 11:25:48.366194 [ 25 ] <Error> BaseDaemon: 1. clickhouse-server(DB::LogBlockOutputStream::write(DB::Block const&)+0x120) [0x2a881e0]\r\n2017.08.20 11:25:48.366211 [ 25 ] <Error> BaseDaemon: 2. clickhouse-server(DB::PushingToViewsBlockOutputStream::write(DB::Block const&)+0x445) [0x2907f55]\r\n2017.08.20 11:25:48.366229 [ 25 ] <Error> BaseDaemon: 3. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x91) [0x2cf5f51]\r\n2017.08.20 11:25:48.366245 [ 25 ] <Error> BaseDaemon: 4. clickhouse-server(DB::PushingToViewsBlockOutputStream::write(DB::Block const&)+0x3f1) [0x2907f01]\r\n2017.08.20 11:25:48.366260 [ 25 ] <Error> BaseDaemon: 5. clickhouse-server(DB::MaterializingBlockOutputStream::write(DB::Block const&)+0x28) [0x2905728]\r\n2017.08.20 11:25:48.366275 [ 25 ] <Error> BaseDaemon: 6. clickhouse-server(DB::AddingDefaultBlockOutputStream::write(DB::Block const&)+0x235) [0x2c1ab25]\r\n2017.08.20 11:25:48.366290 [ 25 ] <Error> BaseDaemon: 7. clickhouse-server(DB::ProhibitColumnsBlockOutputStream::write(DB::Block const&)+0x4f) [0x2cbf22f]\r\n2017.08.20 11:25:48.366307 [ 25 ] <Error> BaseDaemon: 8. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x91) [0x2cf5f51]\r\n2017.08.20 11:25:48.366323 [ 25 ] <Error> BaseDaemon: 9. clickhouse-server(DB::NullAndDoCopyBlockInputStream::readImpl()+0x24) [0x2903e34]\r\n2017.08.20 11:25:48.366337 [ 25 ] <Error> BaseDaemon: 10. clickhouse-server(DB::IProfilingBlockInputStream::read()+0x1e6) [0x22f9216]\r\n2017.08.20 11:25:48.366362 [ 25 ] <Error> BaseDaemon: 11. clickhouse-server(DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::atomic<bool>*)+0x5c) [0x2cf5f1c]\r\n2017.08.20 11:25:48.366384 [ 25 ] <Error> BaseDaemon: 12. clickhouse-server(DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, DB::Context&, std::function<void (std::string const&)>)+0x58b) [0x29a5a6b]\r\n2017.08.20 11:25:48.366403 [ 25 ] <Error> BaseDaemon: 13. clickhouse-server(DB::HTTPHandler::processQuery(Poco::Net::HTTPServerRequest&, HTMLForm&, Poco::Net::HTTPServerResponse&, DB::HTTPHandler::Output&)+0x1e19) [0x1014449]\r\n2017.08.20 11:25:48.366418 [ 25 ] <Error> BaseDaemon: 14. clickhouse-server(DB::HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest&, Poco::Net::HTTPServerResponse&)+0x336) [0x10166e6]\r\n2017.08.20 11:25:48.366433 [ 25 ] <Error> BaseDaemon: 15. clickhouse-server(Poco::Net::HTTPServerConnection::run()+0x253) [0x32054d3]\r\n2017.08.20 11:25:48.366447 [ 25 ] <Error> BaseDaemon: 16. clickhouse-server(Poco::Net::TCPServerConnection::start()+0xf) [0x31feb5f]\r\n2017.08.20 11:25:48.366461 [ 25 ] <Error> BaseDaemon: 17. clickhouse-server(Poco::Net::TCPServerDispatcher::run()+0x10b) [0x320036b]\r\n2017.08.20 11:25:48.366477 [ 25 ] <Error> BaseDaemon: 18. clickhouse-server(Poco::PooledThread::run()+0x87) [0x3306737]\r\n2017.08.20 11:25:48.366491 [ 25 ] <Error> BaseDaemon: 19. clickhouse-server(Poco::ThreadImpl::runnableEntry(void*)+0x96) [0x33012c6]\r\n2017.08.20 11:25:48.366503 [ 25 ] <Error> BaseDaemon: 20. /lib64/libpthread.so.0(+0x7dc5) [0x7f560c75cdc5]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/yandex/ClickHouse/issues/comments/408680145","html_url":"https://github.com/yandex/ClickHouse/issues/1125#issuecomment-408680145","issue_url":"https://api.github.com/repos/yandex/ClickHouse/issues/1125","id":408680145,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODY4MDE0NQ==","user":{"login":"inkrement","id":604528,"node_id":"MDQ6VXNlcjYwNDUyOA==","avatar_url":"https://avatars3.githubusercontent.com/u/604528?v=4","gravatar_id":"","url":"https://api.github.com/users/inkrement","html_url":"https://github.com/inkrement","followers_url":"https://api.github.com/users/inkrement/followers","following_url":"https://api.github.com/users/inkrement/following{/other_user}","gists_url":"https://api.github.com/users/inkrement/gists{/gist_id}","starred_url":"https://api.github.com/users/inkrement/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inkrement/subscriptions","organizations_url":"https://api.github.com/users/inkrement/orgs","repos_url":"https://api.github.com/users/inkrement/repos","events_url":"https://api.github.com/users/inkrement/events{/privacy}","received_events_url":"https://api.github.com/users/inkrement/received_events","type":"User","site_admin":false},"created_at":"2018-07-29T14:07:04Z","updated_at":"2018-07-29T14:07:04Z","author_association":"NONE","body":"@blinkov I am afraid that I can not reproduce the data or the exact setting :/ ... Thus, I'll close the issue for now and reopen it if I run into it again."}}
{"actor":{"display_login":"inkrement"}}