{"action":"created","issue":{"url":"https://api.github.com/repos/slick/slick/issues/1117","labels_url":"https://api.github.com/repos/slick/slick/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/slick/slick/issues/1117/comments","events_url":"https://api.github.com/repos/slick/slick/issues/1117/events","html_url":"https://github.com/slick/slick/issues/1117","id":65406702,"number":1117,"title":"Runtime MatchError when using countDistinct","user":{"login":"Frumsz","id":11734545,"avatar_url":"https://avatars.githubusercontent.com/u/11734545?v=3","gravatar_id":"","url":"https://api.github.com/users/Frumsz","html_url":"https://github.com/Frumsz","followers_url":"https://api.github.com/users/Frumsz/followers","following_url":"https://api.github.com/users/Frumsz/following{/other_user}","gists_url":"https://api.github.com/users/Frumsz/gists{/gist_id}","starred_url":"https://api.github.com/users/Frumsz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frumsz/subscriptions","organizations_url":"https://api.github.com/users/Frumsz/orgs","repos_url":"https://api.github.com/users/Frumsz/repos","events_url":"https://api.github.com/users/Frumsz/events{/privacy}","received_events_url":"https://api.github.com/users/Frumsz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-31T09:21:35Z","updated_at":"2015-04-30T07:23:03Z","closed_at":null,"body":"I've come accross what I presume to be a bug, or otherwise maybe an improvement (since I could see it making sense having to specify a column(s) to distinct on):\r\n\r\nI have encountered this with RC-1 and RC-2 and Pgsql\r\n\r\nConsider the following:\r\n```scala\r\nval products = TableQuery[Products]\r\nval customersToProducts = TableQuery[CustomersToProducts]\r\n\r\nval productsWithCustomerCountQuery = products.map(p => (p, customersToProducts.filter(_.productId === p.id).countDistinct))\r\n\r\ndb.run(productsWithCustomerCountQuery.result)\r\n```\r\nThe query will result in a runtime match error:\r\n```scala\r\nplay.api.Application$$anon$1: Execution exception[[MatchError: Some(Pure $@1677218149) (of class scala.Some)]]\r\n        at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.8.jar:2.3.8]\r\n        at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.8.jar:2.3.8]\r\n        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.8.jar:2.3.8]\r\n        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.8.jar:2.3.8]\r\n        at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [scala-library-2.11.6.jar:na]\r\nCaused by: scala.MatchError: Some(Pure $@1677218149) (of class scala.Some)\r\n        at slick.compiler.FuseComprehensions.slick$compiler$FuseComprehensions$$tr$1(Relational.scala:361) ~[slick_2.11-3.0.0-RC2.jar:na]\r\n        at slick.compiler.FuseComprehensions$$anonfun$slick$compiler$FuseComprehensions$$tr$1$2.apply(Relational.scala:372) ~[slick_2.11-3.0.0-RC2.jar:na]\r\n        at slick.compiler.FuseComprehensions$$anonfun$slick$compiler$FuseComprehensions$$tr$1$2.apply(Relational.scala:372) ~[slick_2.11-3.0.0-RC2.jar:na]\r\n        at slick.ast.Util$$anonfun$mapOrNone$1.apply(Util.scala:15) ~[slick_2.11-3.0.0-RC2.jar:na]\r\n        at slick.ast.Util$$anonfun$mapOrNone$1.apply(Util.scala:14) ~[slick_2.11-3.0.0-RC2.jar:na]\r\n```"},"comment":{"url":"https://api.github.com/repos/slick/slick/issues/comments/97692276","html_url":"https://github.com/slick/slick/issues/1117#issuecomment-97692276","issue_url":"https://api.github.com/repos/slick/slick/issues/1117","id":97692276,"user":{"login":"anand-singh","id":4903911,"avatar_url":"https://avatars.githubusercontent.com/u/4903911?v=3","gravatar_id":"","url":"https://api.github.com/users/anand-singh","html_url":"https://github.com/anand-singh","followers_url":"https://api.github.com/users/anand-singh/followers","following_url":"https://api.github.com/users/anand-singh/following{/other_user}","gists_url":"https://api.github.com/users/anand-singh/gists{/gist_id}","starred_url":"https://api.github.com/users/anand-singh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anand-singh/subscriptions","organizations_url":"https://api.github.com/users/anand-singh/orgs","repos_url":"https://api.github.com/users/anand-singh/repos","events_url":"https://api.github.com/users/anand-singh/events{/privacy}","received_events_url":"https://api.github.com/users/anand-singh/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T07:23:02Z","updated_at":"2015-04-30T07:23:02Z","body":"+1"}}