Skip to content
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

join with groupByMap compile error #268

Open
krrrr38 opened this issue May 6, 2023 · 0 comments
Open

join with groupByMap compile error #268

krrrr38 opened this issue May 6, 2023 · 0 comments

Comments

@krrrr38
Copy link

krrrr38 commented May 6, 2023

Version: 4.6.0.1 and master branch (sha1: 16c5404)
Module: quill-sql
Scala: 3.2.2

Expected behavior

inline def q =
  query[Person]
    .join(query[Person])
    .on((p1, p2) => p1.name == p2.name)
    .groupByMap(r => r._1.age)(r => (r._1.age, max(r._2.age)))
val m = ctx.run(q)

compile success with SELECT p1.age, MAX(p2.age) FROM person p1 join person p2 on p1.name = p2.name GROUP BY p1.age.

Actual behavior

image

Query splicing failed due to error: scala.MatchError: querySchema("Person").join(querySchema("Person")).on((p1, p2) => p1.name == p2.name).groupByMap(r => r._1.age)(r => (r._1.age, r._2.age.max)) (of class io.getquill.ast.GroupByMap)
	at io.getquill.norm.capture.AvoidAliasConflict.apply$$anonfun$1(AvoidAliasConflict.scala:203)
	at io.getquill.util.Interpolator$Traceable.andReturnIf(Interpolator.scala:193)
	at io.getquill.norm.capture.AvoidAliasConflict.apply(AvoidAliasConflict.scala:205)
	at io.getquill.ast.StatefulTransformer.apply(StatefulTransformer.scala:9)
	at io.getquill.ast.StatefulTransformer.apply$(StatefulTransformer.scala:3)
	at io.getquill.norm.capture.AvoidAliasConflict.apply(AvoidAliasConflict.scala:43)
	at io.getquill.ast.StatefulTransformer.apply(StatefulTransformer.scala:153)
	at io.getquill.ast.StatefulTransformer.apply$(StatefulTransformer.scala:3)
	at io.getquill.norm.capture.AvoidAliasConflict.recurseAndApply$$anonfun$1(AvoidAliasConflict.scala:81)
	at io.getquill.util.Interpolator$Traceable.andReturnIf(Interpolator.scala:193)
	at io.getquill.norm.capture.AvoidAliasConflict.recurseAndApply(AvoidAliasConflict.scala:92)
	at io.getquill.norm.capture.AvoidAliasConflict.apply$$anonfun$1(AvoidAliasConflict.scala:145)
	at io.getquill.util.Interpolator$Traceable.andReturnIf(Interpolator.scala:193)
	at io.getquill.norm.capture.AvoidAliasConflict.apply(AvoidAliasConflict.scala:205)
	at io.getquill.norm.capture.AvoidAliasConflictApply.apply(AvoidAliasConflict.scala:287)
	at io.getquill.norm.Normalize.apply$$anonfun$1(Normalize.scala:37)
	at io.getquill.util.Interpolator$Traceable.andReturn(Interpolator.scala:172)
	at io.getquill.norm.Normalize.apply(Normalize.scala:37)
	at io.getquill.ast.StatelessTransformer.apply(StatelessTransformer.scala:9)
	at io.getquill.ast.StatelessTransformer.apply$(StatelessTransformer.scala:3)
	at io.getquill.norm.Normalize.apply(Normalize.scala:30)
	at io.getquill.context.sql.norm.SqlNormalize.$init$$$anonfun$5(SqlNormalize.scala:40)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:87)

Steps to reproduce the behavior

https://scastie.scala-lang.org/DdIgtlwTSzSHJsUyQrGEOg

Workaround

@getquill/maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant