File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed 
quill-engine/src/main/scala/io/getquill/sql Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff 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))),
Original file line number Diff line number Diff 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
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments