{"action":"opened","issue":{"url":"https://api.github.com/repos/slick/slick/issues/1606","repository_url":"https://api.github.com/repos/slick/slick","labels_url":"https://api.github.com/repos/slick/slick/issues/1606/labels{/name}","comments_url":"https://api.github.com/repos/slick/slick/issues/1606/comments","events_url":"https://api.github.com/repos/slick/slick/issues/1606/events","html_url":"https://github.com/slick/slick/issues/1606","id":176169311,"number":1606,"title":"Query with a lot of conditions causes StackOverflowError","user":{"login":"takezoe","id":1094760,"avatar_url":"https://avatars.githubusercontent.com/u/1094760?v=3","gravatar_id":"","url":"https://api.github.com/users/takezoe","html_url":"https://github.com/takezoe","followers_url":"https://api.github.com/users/takezoe/followers","following_url":"https://api.github.com/users/takezoe/following{/other_user}","gists_url":"https://api.github.com/users/takezoe/gists{/gist_id}","starred_url":"https://api.github.com/users/takezoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takezoe/subscriptions","organizations_url":"https://api.github.com/users/takezoe/orgs","repos_url":"https://api.github.com/users/takezoe/repos","events_url":"https://api.github.com/users/takezoe/events{/privacy}","received_events_url":"https://api.github.com/users/takezoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-10T08:52:29Z","updated_at":"2016-09-10T08:52:29Z","closed_at":null,"body":"With Slick 3.1.1, I got StackOverflowError for a query which has a lot of conditions.\r\n\r\nCode to reproduce easily is below:\r\n\r\n```scala\r\nval seq = Range(1, 500)\r\nAccounts.filter { t => seq.map { x => t.userId === x.bind }.reduce(_ || _)}.list\r\n```\r\n\r\nAn error caused by above query is:\r\n\r\n```\r\njava.lang.StackOverflowError\r\n\tat scala.collection.immutable.Set$class.seq(Set.scala:55)\r\n\tat scala.collection.immutable.Set$EmptySet$.seq(Set.scala:68)\r\n\tat scala.collection.immutable.Set$EmptySet$.seq(Set.scala:68)\r\n\tat scala.collection.SetLike$class.$plus$plus(SetLike.scala:141)\r\n\tat scala.collection.AbstractSet.$plus$plus(Set.scala:47)\r\n\tat slick.compiler.ExpandSums.slick$compiler$ExpandSums$$tr$1(ExpandSums.scala:27)\r\n\tat slick.compiler.ExpandSums$$anonfun$7.apply(ExpandSums.scala:32)\r\n\tat slick.compiler.ExpandSums$$anonfun$7.apply(ExpandSums.scala:32)\r\n\tat slick.util.ConstArray.endoMap(ConstArray.scala:122)\r\n\tat slick.ast.Node$class.mapChildren(Node.scala:51)\r\n\tat slick.ast.Apply.mapChildren(Node.scala:539)\r\n\tat slick.compiler.ExpandSums.slick$compiler$ExpandSums$$tr$1(ExpandSums.scala:32)\r\n\tat slick.compiler.ExpandSums$$anonfun$7.apply(ExpandSums.scala:32)\r\n\tat slick.compiler.ExpandSums$$anonfun$7.apply(ExpandSums.scala:32)\r\n\tat slick.util.ConstArray.endoMap(ConstArray.scala:122)\r\n\tat slick.ast.Node$class.mapChildren(Node.scala:51)\r\n\tat slick.ast.Apply.mapChildren(Node.scala:539)\r\n```\r\n\r\nI tried decreasing condition. Then I got another StackOverflowError.\r\n\r\n```scala\r\nval seq = Range(1, 200)\r\nAccounts.filter { t => seq.map { x => t.userId === x.bind }.reduce(_ || _)}.list\r\n```\r\n\r\nAn error caused by above query is:\r\n\r\n```\r\njava.lang.StackOverflowError\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder.expr(JdbcStatementBuilderComponent.scala:306)\r\n\tat slick.driver.PostgresDriver$QueryBuilder.expr(PostgresDriver.scala:164)\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder$$anonfun$expr$7.apply(JdbcStatementBuilderComponent.scala:376)\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder$$anonfun$expr$7.apply(JdbcStatementBuilderComponent.scala:376)\r\n\tat slick.util.SQLBuilder.sep(SQLBuilder.scala:31)\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder.expr(JdbcStatementBuilderComponent.scala:376)\r\n\tat slick.driver.PostgresDriver$QueryBuilder.expr(PostgresDriver.scala:164)\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder$$anonfun$expr$7.apply(JdbcStatementBuilderComponent.scala:376)\r\n\tat slick.driver.JdbcStatementBuilderComponent$QueryBuilder$$anonfun$expr$7.apply(JdbcStatementBuilderComponent.scala:376)\r\n\tat slick.util.SQLBuilder.sep(SQLBuilder.scala:31)\r\n```"}}
{"actor":{"display_login":"takezoe"}}