-
-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime exception compiling query containing groupBy(x=>x) #252
Comments
Cannot reproduce. This works for me in M3. |
Hmmm... the above code definitely throws the above exception for me with the following build.sbt:
|
Maybe a self-contained github project that demonstrates the issue would On Thu, Dec 12, 2013 at 9:27 AM, Ian Baker notifications@github.com wrote:
|
Adds test cases around using groupBy with an identity mapping (i.e. .groupBy(x => x)).
Ok, I copied the code above into a test case in the slick testkit. The test fails at both 2.0.0-M3 and HEAD. Please take a look. |
Having the same issue after upgrading from slick 1.0.1. The same query works in Slick 1. Is there a workaround compatible with Slick 2? I'm also curious as to why this issue is postponed until Slick 2.1? Looks like a regression to me. |
I wasn't aware that this is a regression. I assume that #565 will fix it but that PR caused other problems so it needs some more work for 2.0.1. |
Thanks for the quick response, looking forward to the next release. |
In inferTypes, we used to replace structural views of NominalTypes after constructing all table types. At that point, however, type inference (which runs before table types can be determined) may have copied a structural view on its own (without the enclosing NominalType) into another type. For instance, this happens in the typing of GroupBy, where the "by" type needs to be copied purely as a structural view. In these cases the resulting NoType could not be patched to the correct type. To fix this problem we use a special NoTypeView(ts) with the same TypeSymbol as the surrounding NominalType in table types, which can be patched even after the NominalType has been lost. Tests in AggregateTest.testGroupBy. Fixes issue #252.
In inferTypes, we used to replace structural views of NominalTypes after constructing all table types. At that point, however, type inference (which runs before table types can be determined) may have copied a structural view on its own (without the enclosing NominalType) into another type. For instance, this happens in the typing of GroupBy, where the "by" type needs to be copied purely as a structural view. In these cases the resulting NoType could not be patched to the correct type. To fix this problem we use the new type UnassignedStructuralType(ts) with the same TypeSymbol as the surrounding NominalType in table types, which can be patched even after the NominalType has been lost. The only remaining use of NoType in StarAnd can be replaced by UnassignedType, thus eliminating NoType entirely. Tests in AggregateTest.testGroupBy. Fixes issue #252.
GroupBy fixes have been merged for 2.0.1. Closing. |
I am trying to use the pattern
query.groupBy(x=>x).map(_._1)
to simulate aSELECT DISTINCT
; however, I am hitting a runtime exception in some situations.This pattern works if
query
is aTableQuery
. A similar query of the formquery.groupBy(_.*).map(_._1)
works as expected. However, more generic queries of the formquery.groupBy(x=>x).map(_._1)
crash with the error:I'm using the lastest milestone: 2.0.0-M3.
Example code demonstrating the issue:
The text was updated successfully, but these errors were encountered: