You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon upgrading to Slick 3.3.3 in order to get the #2097 fix for a bug with distinctOn described in #1340 - another case was observed when distinctOn is used for multiple columns (with MySQL) that's now failing with a ClassCastException.:
STEPS TO REPRODUCE:
A sample of the query is below, however the error is transient and
/* Composed from various joins and filters. */
def query: Query[(ClientTable, UserTable, OrganizationUserTable, PhoneTable), (ClientRow, UserRow[Value], OrganizationUserRow, PhoneRow[Value]), Seq] = ???
query
.map { case (client, user, _, phone) => (client, user, phone) }
.distinctOn { case (client, user, phone) => (client.id, user.userId, phone.id) }
(In scope are imports from an extension of slick.jdbc.MySQLProfile that provides mappers for various ID wrapper types)
EXPECTED RESULT:
Execute distinctOn without exception
ACTUAL RESULT:
java.lang.ClassCastException: class classpath.to.backend.persistence.UserId cannot be cast to class classpath.to.backend.persistence.ClientId (classpath.to.backend.persistence.UserId and classpath.to.backend.persistence.ClientId are in unnamed module of loader sbt.internal.LayeredClassLoader @9bb579c
[info] at scala.Function4.$anonfun$tupled$1(Function4.scala:40)
[info] at slick.relational.TypeMappingResultConverter.read(ResultConverter.scala:134)
[info] at slick.relational.ProductResultConverter.read(ResultConverter.scala:54)
[info] at slick.relational.ProductResultConverter.read(ResultConverter.scala:44)
[info] at slick.jdbc.JdbcInvokerComponent$QueryInvokerImpl.extractValue(JdbcInvokerComponent.scala:36)
[info] at slick.jdbc.StatementInvoker$$anon$2.extractValue(StatementInvoker.scala:67)
[info] at slick.jdbc.PositionedResultIterator.fetchNext(PositionedResult.scala:176)
[info] at slick.util.ReadAheadIterator.update(ReadAheadIterator.scala:28)
[info] at slick.util.ReadAheadIterator.hasNext(ReadAheadIterator.scala:34)
[info] at slick.util.ReadAheadIterator.hasNext$(ReadAheadIterator.scala:33)
[info] at slick.jdbc.PositionedResultIterator.hasNext(PositionedResult.scala:167)
[info] at slick.jdbc.StreamingInvokerAction.emitStream(StreamingInvokerAction.scala:31)
The text was updated successfully, but these errors were encountered:
DESCRIPTION:
Upon upgrading to Slick 3.3.3 in order to get the #2097 fix for a bug with
distinctOn
described in #1340 - another case was observed whendistinctOn
is used for multiple columns (with MySQL) that's now failing with aClassCastException
.:STEPS TO REPRODUCE:
A sample of the query is below, however the error is transient and
(In scope are imports from an extension of
slick.jdbc.MySQLProfile
that provides mappers for various ID wrapper types)EXPECTED RESULT:
Execute
distinctOn
without exceptionACTUAL RESULT:
The text was updated successfully, but these errors were encountered: