Skip to content

Commit 3b7f2f5

Browse files
committed
remove from-recursion not needed
1 parent 1a30b60 commit 3b7f2f5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

quill-engine/src/main/scala/io/getquill/sql/SqlQuery.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ final case class FlattenSqlQuery(
109109

110110
def mapAsts(f: Ast => Ast): FlattenSqlQuery =
111111
copy(
112-
from = from.map(_.mapAst(f)),
113112
where = where.map(f),
114113
groupBy = groupBy.map(f),
115114
orderBy = orderBy.map(o => o.copy(ast = f(o.ast))),

quill-engine/src/main/scala/io/getquill/sql/norm/RemoveExtraAlias.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ case class ValueizeSingleLeafSelects(strategy: NamingStrategy) extends Stateless
2121
// Turn every `SELECT primitive-x` into a `SELECT case-class-x.primitive-value`
2222
override protected def expandNested(q: FlattenSqlQuery, level: QueryLevel): FlattenSqlQuery = {
2323
// get the alises before we transform (i.e. Valueize) the contexts inside turning the leaf-quat alises into product-quat alises
24-
val fromContextAliases = collectAliases(q.from).filter(!_.quat.isProduct)
24+
val leafValuedFroms = collectAliases(q.from).filter(!_.quat.isProduct)
2525
// now transform the inner clauses
2626
val from = q.from.map(expandContext(_))
2727

2828
def containsAlias(ast: Ast): Boolean =
29-
CollectAst.byType[Ident](ast).exists(id => fromContextAliases.contains(id))
29+
CollectAst.byType[Ident](ast).exists(id => leafValuedFroms.contains(id))
3030

3131
// If there is one single select clause that has a primitive (i.e. Leaf) quat then we can alias it to "value"
3232
// This is the case of `SELECT primitive FROM (SELECT p.age from Person p) AS primitive`
@@ -40,7 +40,7 @@ case class ValueizeSingleLeafSelects(strategy: NamingStrategy) extends Stateless
4040
val valuizedQuery =
4141
q.copy(from = from)(q.quat).mapAsts { ast =>
4242
if (containsAlias(ast)) {
43-
val reductions = CollectAst.byType[Ident](ast).filter(id => fromContextAliases.contains(id)).map(id => id -> valueize(id))
43+
val reductions = CollectAst.byType[Ident](ast).filter(id => leafValuedFroms.contains(id)).map(id => id -> valueize(id))
4444
BetaReduction(ast, TypeBehavior.ReplaceWithReduction, reductions: _*)
4545
} else {
4646
ast

0 commit comments

Comments
 (0)