Regression in complex inner queries since RC6
After I upgraded to tip from RC6 I got exceptions when trying to execute some complex queries. These same queries were written against RC3 and worked against RC6 so there is a regression since then. I looked at the code in question and my guess it has something to do with contributions from peterb and the changes made to pass around copies of subqueries, if the parent fields aren't being copied that would probably lead to the same error.
This is a very complex query and I haven't tried to make a simpler repro case yet, I am hoping the stack trace and what the query is supposed to look like are enough to find the error. If not I can work on a reproduction case.
-------------------------------------------------------
Query when using RC6:
This is a very complex query and I haven't tried to make a simpler repro case yet, I am hoping the stack trace and what the query is supposed to look like are enough to find the error. If not I can work on a reproduction case.
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:185)
at scala.None$.get(Option.scala:183)
at org.squeryl.dsl.ast.ExportedSelectElement.innerTarget(SelectElement.scala:369)
at org.squeryl.dsl.ast.ExportedSelectElement.needsOuterScope(SelectElement.scala:353)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.gd1$1(ExpressionNode.scala:604)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:603)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:602)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scala:54)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(ExpressionNode.scala:55)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(ExpressionNode.scala:55)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scala:55)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(ExpressionNode.scala:55)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(ExpressionNode.scala:55)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scala:55)
at org.squeryl.dsl.ast.ExpressionNode$class.visitDescendants(ExpressionNode.scala:84)
at org.squeryl.dsl.ast.RightHandSideOfIn.visitDescendants(ExpressionNode.scala:571)
at org.squeryl.dsl.ast.NestedExpression$class.propagateOuterScope(ExpressionNode.scala:602)
at org.squeryl.dsl.ast.RightHandSideOfIn.propagateOuterScope(ExpressionNode.scala:571)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:120)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:120)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:57)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:43)
at org.squeryl.dsl.ast.QueryExpressionNode.propagateOuterScope(QueryExpressionNode.scala:120)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:102)
at org.squeryl.dsl.boilerplate.Query2.<init>(Query1.scala:53)
at org.squeryl.dsl.boilerplate.Query2.createCopy(Query1.scala:46)
at org.squeryl.dsl.boilerplate.Query2.createCopy(Query1.scala:38)
at org.squeryl.dsl.AbstractQuery.copy(AbstractQuery.scala:114)
at org.squeryl.dsl.AbstractQuery.createSubQueryable(AbstractQuery.scala:250)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:27)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:25)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
at org.totalgrid.reef.services.core.EntityTreeQueries$QueryNode.fillChildren(EntityQueries.scala:324)
-------------------------------------------------------
Query when using RC6:
'QueryExpressionNode[root:c42091]:rsm='ResultSetMapper:36151c()--
'ExportedSelectElement:q1.Entity2_name
org.squeryl.dsl.ast.ExportedSelectElement$$anon$4
'ExportedSelectElement:q1.Entity2_id
org.squeryl.dsl.ast.ExportedSelectElement$$anon$4
'QueryExpressionNode[a40b6e]:rsm='ResultSetMapper:1ea9246()--
'FieldSelectElement:Entity2_name
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:Entity2_id
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:EntityEdge3_childId
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:EntityEdge3_relationship
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:EntityEdge3_id
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:EntityEdge3_parentId
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'FieldSelectElement:EntityEdge3_distance
org.squeryl.dsl.ast.FieldSelectElement$$anon$3
'ViewExpressionNode[sample:Entity[3c6b88]]:rsm='ResultSetMapper:1f81b9e($(1->Entity.name:java.lang.String),$(2->Entity.id:java.lang.Long))--*
'ViewExpressionNode[sample:EntityEdge[10da3e7]]:rsm='ResultSetMapper:13da092()--
'BinaryOperatorNode:and
'BinaryOperatorNode:and
'BinaryOperatorNode:and
'BinaryOperatorNode:=
'SelectElementReference:Entity2.id:java.lang.Long
'SelectElementReference:EntityEdge3.childId:java.lang.Long
'BinaryOperatorNode:in
'SelectElementReference:EntityEdge3.parentId:java.lang.Long
org.squeryl.dsl.ast.RightHandSideOfIn
'BinaryOperatorNode:in
'SelectElementReference:Entity2.id:java.lang.Long
org.squeryl.dsl.ast.RightHandSideOfIn
'BinaryOperatorNode:=
'SelectElementReference:EntityEdge3.relationship:java.lang.String
'ConstantExpressionNode:owns
Select
"q1"."Entity2_name" as "q1_Entity2_name",
"q1"."Entity2_id" as "q1_Entity2_id"
From
(Select
"Entity2"."name" as "Entity2_name",
"Entity2"."id" as "Entity2_id",
"EntityEdge3"."childId" as "EntityEdge3_childId",
"EntityEdge3"."relationship" as "EntityEdge3_relationship",
"EntityEdge3"."id" as "EntityEdge3_id",
"EntityEdge3"."parentId" as "EntityEdge3_parentId",
"EntityEdge3"."distance" as "EntityEdge3_distance"
From
"Entity" "Entity2",
"EntityEdge" "EntityEdge3"
Where
(((("Entity2"."id" = "EntityEdge3"."childId") and ("EntityEdge3"."parentId" in (Select
"q1"."q2_Entity3_id" as "q1_q2_Entity3_id"
From
(Select
"q2"."Entity3_name" as "q2_Entity3_name",
"q2"."Entity3_id" as "q2_Entity3_id"
From
(Select
"Entity3"."name" as "Entity3_name",
"Entity3"."id" as "Entity3_id",
"EntityEdge4"."childId" as "EntityEdge4_childId",
"EntityEdge4"."relationship" as "EntityEdge4_relationship",
"EntityEdge4"."id" as "EntityEdge4_id",
"EntityEdge4"."parentId" as "EntityEdge4_parentId",
"EntityEdge4"."distance" as "EntityEdge4_distance"
From
"Entity" "Entity3",
"EntityEdge" "EntityEdge4"
Where
(((("Entity3"."id" = "EntityEdge4"."childId") and ("EntityEdge4"."parentId" in (Select
"q1"."Entity2_id" as "q1_Entity2_id"
From
(Select distinct
"Entity2"."name" as "Entity2_name",
"Entity2"."id" as "Entity2_id"
From
"Entity" "Entity2",
"EntityToTypeJoins" "EntityToTypeJoins3"
Where
(("Entity2"."name" = 'Pittsboro') and (("EntityToTypeJoins3"."entType" in ('Substation')) and ("EntityToTypeJoins3"."entityId" = "Entity2"."id")))
) "q1"
))) and ("Entity3"."id" in (Select
"EntityToTypeJoins2"."entityId" as "v1"
From
"EntityToTypeJoins" "EntityToTypeJoins2"
Where
("EntityToTypeJoins2"."entType" in ('Bus'))
))) and ("EntityEdge4"."relationship" = 'owns'))
) "q2"
) "q1"
))) and ("Entity2"."id" in (Select
"EntityToTypeJoins2"."entityId" as "v1"
From
"EntityToTypeJoins" "EntityToTypeJoins2"
Where
("EntityToTypeJoins2"."entType" in ('Point'))
))) and ("EntityEdge3"."relationship" = 'owns'))
) "q1"
Leave a comment
on 2011-04-26 17:03 *
By maxime.levesque
Assigned to set to maxime.levesque
Milestone set to 0.9.4-RC7
Priority changed from Normal (3) to High (2)
on 2011-04-26 17:14 *
By sam.hendley
It occured to me that I had compiled this for 2.8.0, could that have made a difference?
on 2011-04-26 17:26 *
By maxime.levesque
I'd really apprciate a repro case for this, it will help against future regressions, the fix will also be much easyer to find.
on 2011-04-27 16:59 *
By sam.hendley
From Max:
If your time is scarce, see if it goes away when you removing the copying in these implicits in QueryDsl
i.e. by changing :
q.copy(false).ast
to :
q..ast
implicit def singleColumnQuery2RightHandSideOfIn[A](q: Query[A]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[A]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[Option[A]]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[A]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[Option[A]]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
It will give me some insight.
If your time is scarce, see if it goes away when you removing the copying in these implicits in QueryDsl
i.e. by changing :
q.copy(false).ast
to :
q..ast
implicit def singleColumnQuery2RightHandSideOfIn[A](q: Query[A]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[A]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[Option[A]]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[A]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[Option[A]]]) =
new RightHandSideOfIn[A](q.copy(false).ast)
It will give me some insight.
on 2011-04-27 17:00 *
By sam.hendley
Making the suggested changes did fix this issue. And didn't break any of the tests
on 2011-04-27 17:17 *
By maxime.levesque
The copying still needs to go back in there, because there is a bit of mutability that occurs during query construction time. The copying is there
to ensure that a subquery is not affected by being referenced as a subquery within another query.
to ensure that a subquery is not affected by being referenced as a subquery within another query.
on 2012-01-10 17:56 *
By sam.hendley
I just tried 0.9.5-RC1 and this bug is still occuring, any new thoughts on what could be causing this issue? If not i'll try to construct a reproduction case.
New stack trace, same query.
{{
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:275)
at scala.None$.get(Option.scala:273)
at org.squeryl.dsl.ast.SelectElement$class.parentQueryable(SelectElement.scala:58)
at org.squeryl.dsl.ast.FieldSelectElement.parentQueryable(SelectElement.scala:173)
at org.squeryl.dsl.ast.ExportedSelectElement$$anonfun$isDirectOuterReference$1.apply(SelectElement.scala:355)
at org.squeryl.dsl.ast.ExportedSelectElement$$anonfun$isDirectOuterReference$1.apply(SelectElement.scala:355)
at scala.collection.LinearSeqOptimized$class.exists(LinearSeqOptimized.scala:79)
at scala.collection.immutable.List.exists(List.scala:45)
at org.squeryl.dsl.ast.ExportedSelectElement.isDirectOuterReference(SelectElement.scala:355)
at org.squeryl.dsl.ast.ExportedSelectElement.needsOuterScope(SelectElement.scala:353)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.gd1$1(ExpressionNode.scala:613)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:612)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:611)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:56)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:57)
at org.squeryl.dsl.ast.ExpressionNode$class.visitDescendants(ExpressionNode.scala:86)
at org.squeryl.dsl.ast.RightHandSideOfIn.visitDescendants(ExpressionNode.scala:581)
at org.squeryl.dsl.ast.NestedExpression$class.propagateOuterScope(ExpressionNode.scala:611)
at org.squeryl.dsl.ast.RightHandSideOfIn.propagateOuterScope(ExpressionNode.scala:581)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:129)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:129)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:44)
at org.squeryl.dsl.ast.QueryExpressionNode.propagateOuterScope(QueryExpressionNode.scala:129)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:106)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:34)
at org.squeryl.dsl.boilerplate.Query1.createCopy(Query1.scala:29)
at org.squeryl.dsl.boilerplate.Query1.createCopy(Query1.scala:23)
at org.squeryl.dsl.AbstractQuery.copy(AbstractQuery.scala:118)
at org.squeryl.dsl.AbstractQuery.createSubQueryable(AbstractQuery.scala:255)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:27)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:25)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.expr(EntityQuery.scala:205)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$lowerQuery$1$$anonfun$apply$6.apply(EntityQuery.sc
ala:200)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$lowerQuery$1$$anonfun$apply$6.apply(EntityQuery.sc
ala:200)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at scala.Option.map(Option.scala:134)
at org.squeryl.dsl.fsm.BaseQueryYield.whereClause(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield.queryElements(BaseQueryYield.scala:71)
at org.squeryl.dsl.ast.QueryExpressionNode.<init>(QueryExpressionNode.scala:35)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:103)
at org.squeryl.dsl.boilerplate.Query2.<init>(Query1.scala:53)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:28)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.lowerQuery(EntityQuery.scala:199)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.fillChildren(EntityQuery.scala:178)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$fillChildren$1.apply(EntityQuery.scala:195)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$fillChildren$1.apply(EntityQuery.scala:195)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.fillChildren(EntityQuery.scala:195)
at org.totalgrid.reef.services.core.EntityQuery$$anonfun$resultsForQuery$1.apply(EntityQuery.scala:248)
at org.totalgrid.reef.services.core.EntityQuery$$anonfun$resultsForQuery$1.apply(EntityQuery.scala:248)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.totalgrid.reef.services.core.EntityQuery$.resultsForQuery(EntityQuery.scala:248)
at org.totalgrid.reef.services.core.EntityQuery$.resultsForQuery(EntityQuery.scala:235)
at org.totalgrid.reef.services.core.EntityQuery$.protoTreeQuery(EntityQuery.scala:309)
at org.totalgrid.reef.services.core.EntityQuery$.typeIdsFromProtoQuery(EntityQuery.scala:320)
at org.totalgrid.reef.services.core.PointServiceConversion$$anonfun$uniqueQuery$2.apply(PointService.scala:159)
at org.totalgrid.reef.services.core.PointServiceConversion$$anonfun$uniqueQuery$2.apply(PointService.scala:159)
at scala.Option.map(Option.scala:134)
at org.totalgrid.reef.services.core.PointServiceConversion$class.uniqueQuery(PointService.scala:159)
at org.totalgrid.reef.services.core.PointServiceModel.uniqueQuery(PointService.scala:62)
at org.totalgrid.reef.services.core.PointServiceModel.uniqueQuery(PointService.scala:62)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$class.searchParams(UniqueAndSearchQueryable.scala:1
48)
at org.totalgrid.reef.services.core.PointServiceModel.searchParams(PointService.scala:62)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$$anonfun$searchQuery$1$$anonfun$apply$14.apply(Uniq
ueAndSearchQueryable.scala:142)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$$anonfun$searchQuery$1$$anonfun$apply$14.apply(Uniq
ueAndSearchQueryable.scala:142)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at scala.Option.map(Option.scala:134)
at org.squeryl.dsl.fsm.BaseQueryYield.whereClause(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield.queryElements(BaseQueryYield.scala:71)
at org.squeryl.dsl.ast.QueryExpressionNode.<init>(QueryExpressionNode.scala:35)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:103)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:34)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:25)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
}}
New stack trace, same query.
{{
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:275)
at scala.None$.get(Option.scala:273)
at org.squeryl.dsl.ast.SelectElement$class.parentQueryable(SelectElement.scala:58)
at org.squeryl.dsl.ast.FieldSelectElement.parentQueryable(SelectElement.scala:173)
at org.squeryl.dsl.ast.ExportedSelectElement$$anonfun$isDirectOuterReference$1.apply(SelectElement.scala:355)
at org.squeryl.dsl.ast.ExportedSelectElement$$anonfun$isDirectOuterReference$1.apply(SelectElement.scala:355)
at scala.collection.LinearSeqOptimized$class.exists(LinearSeqOptimized.scala:79)
at scala.collection.immutable.List.exists(List.scala:45)
at org.squeryl.dsl.ast.ExportedSelectElement.isDirectOuterReference(SelectElement.scala:355)
at org.squeryl.dsl.ast.ExportedSelectElement.needsOuterScope(SelectElement.scala:353)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.gd1$1(ExpressionNode.scala:613)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:612)
at org.squeryl.dsl.ast.NestedExpression$$anonfun$propagateOuterScope$1.apply(ExpressionNode.scala:611)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:56)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at org.squeryl.dsl.ast.ExpressionNode$$anonfun$org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants$1.apply(Expressi
onNode.scala:57)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.squeryl.dsl.ast.ExpressionNode$class.org$squeryl$dsl$ast$ExpressionNode$$_visitDescendants(ExpressionNode.scal
a:57)
at org.squeryl.dsl.ast.ExpressionNode$class.visitDescendants(ExpressionNode.scala:86)
at org.squeryl.dsl.ast.RightHandSideOfIn.visitDescendants(ExpressionNode.scala:581)
at org.squeryl.dsl.ast.NestedExpression$class.propagateOuterScope(ExpressionNode.scala:611)
at org.squeryl.dsl.ast.RightHandSideOfIn.propagateOuterScope(ExpressionNode.scala:581)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:129)
at org.squeryl.dsl.ast.QueryExpressionNode$$anonfun$propagateOuterScope$1.apply(QueryExpressionNode.scala:129)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:44)
at org.squeryl.dsl.ast.QueryExpressionNode.propagateOuterScope(QueryExpressionNode.scala:129)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:106)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:34)
at org.squeryl.dsl.boilerplate.Query1.createCopy(Query1.scala:29)
at org.squeryl.dsl.boilerplate.Query1.createCopy(Query1.scala:23)
at org.squeryl.dsl.AbstractQuery.copy(AbstractQuery.scala:118)
at org.squeryl.dsl.AbstractQuery.createSubQueryable(AbstractQuery.scala:255)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:27)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:25)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.expr(EntityQuery.scala:205)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$lowerQuery$1$$anonfun$apply$6.apply(EntityQuery.sc
ala:200)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$lowerQuery$1$$anonfun$apply$6.apply(EntityQuery.sc
ala:200)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at scala.Option.map(Option.scala:134)
at org.squeryl.dsl.fsm.BaseQueryYield.whereClause(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield.queryElements(BaseQueryYield.scala:71)
at org.squeryl.dsl.ast.QueryExpressionNode.<init>(QueryExpressionNode.scala:35)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:103)
at org.squeryl.dsl.boilerplate.Query2.<init>(Query1.scala:53)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:28)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.lowerQuery(EntityQuery.scala:199)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.fillChildren(EntityQuery.scala:178)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$fillChildren$1.apply(EntityQuery.scala:195)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode$$anonfun$fillChildren$1.apply(EntityQuery.scala:195)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.totalgrid.reef.services.core.EntityQuery$QueryNode.fillChildren(EntityQuery.scala:195)
at org.totalgrid.reef.services.core.EntityQuery$$anonfun$resultsForQuery$1.apply(EntityQuery.scala:248)
at org.totalgrid.reef.services.core.EntityQuery$$anonfun$resultsForQuery$1.apply(EntityQuery.scala:248)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.totalgrid.reef.services.core.EntityQuery$.resultsForQuery(EntityQuery.scala:248)
at org.totalgrid.reef.services.core.EntityQuery$.resultsForQuery(EntityQuery.scala:235)
at org.totalgrid.reef.services.core.EntityQuery$.protoTreeQuery(EntityQuery.scala:309)
at org.totalgrid.reef.services.core.EntityQuery$.typeIdsFromProtoQuery(EntityQuery.scala:320)
at org.totalgrid.reef.services.core.PointServiceConversion$$anonfun$uniqueQuery$2.apply(PointService.scala:159)
at org.totalgrid.reef.services.core.PointServiceConversion$$anonfun$uniqueQuery$2.apply(PointService.scala:159)
at scala.Option.map(Option.scala:134)
at org.totalgrid.reef.services.core.PointServiceConversion$class.uniqueQuery(PointService.scala:159)
at org.totalgrid.reef.services.core.PointServiceModel.uniqueQuery(PointService.scala:62)
at org.totalgrid.reef.services.core.PointServiceModel.uniqueQuery(PointService.scala:62)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$class.searchParams(UniqueAndSearchQueryable.scala:1
48)
at org.totalgrid.reef.services.core.PointServiceModel.searchParams(PointService.scala:62)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$$anonfun$searchQuery$1$$anonfun$apply$14.apply(Uniq
ueAndSearchQueryable.scala:142)
at org.totalgrid.reef.services.framework.UniqueAndSearchQueryable$$anonfun$searchQuery$1$$anonfun$apply$14.apply(Uniq
ueAndSearchQueryable.scala:142)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield$$anonfun$whereClause$1.apply(BaseQueryYield.scala:63)
at scala.Option.map(Option.scala:134)
at org.squeryl.dsl.fsm.BaseQueryYield.whereClause(BaseQueryYield.scala:63)
at org.squeryl.dsl.fsm.BaseQueryYield.queryElements(BaseQueryYield.scala:71)
at org.squeryl.dsl.ast.QueryExpressionNode.<init>(QueryExpressionNode.scala:35)
at org.squeryl.dsl.AbstractQuery.buildAst(AbstractQuery.scala:103)
at org.squeryl.dsl.boilerplate.Query1.<init>(Query1.scala:34)
at org.squeryl.dsl.boilerplate.FromSignatures$class.from(FromSignatures.scala:25)
at org.squeryl.PrimitiveTypeMode$.from(PrimitiveTypeMode.scala:40)
}}
on 2012-01-10 19:57 *
By maxime.levesque
Without a reproduceable test case I'm pretty clueless, I'll be grateful If you can create one.
on 2012-01-10 23:29 *
By sam.hendley
Is it possible this is related to anything in scala 2.9.1? I tried this test against the 2.9.0-1 build of squeryl? Case class copying maybe?
on 2012-01-11 14:18 *
By maxime.levesque
What was the result of trying it on 2.9.0-1 ?
The RC1 build is available from 2.8.0 and upwards, so if the bug doesn not show up on an earlyer version, it will give some information.
The RC1 build is available from 2.8.0 and upwards, so if the bug doesn not show up on an earlyer version, it will give some information.
on 2012-01-11 14:26 *
By maxime.levesque
BTW, in an earlyer comment changing :
q.copy(false).ast
to :
q..ast
in the following implicits :
implicit def singleColumnQuery2RightHandSideOfIn[A](q: Query[A]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[A]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[Option[A]]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[A]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[Option[A]]]) = new RightHandSideOfIn[A](q.copy(false).ast)
made the problem go away, is it still the case ?
It does give me some insight on the problem (AST copying is not behaving correctly in some cases)
the problem is that the copying is absolutely necessary, it could ba a workaround for you, but the real cure is to fix the copying.
so a reproduction case would be precious to have in the test suite.
q.copy(false).ast
to :
q..ast
in the following implicits :
implicit def singleColumnQuery2RightHandSideOfIn[A](q: Query[A]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[A]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def measureOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Measures[Option[A]]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[A]]) = new RightHandSideOfIn[A](q.copy(false).ast)
implicit def groupOptionSingleColumnQuery2RightHandSideOfIn[A](q: Query[Group[Option[A]]]) = new RightHandSideOfIn[A](q.copy(false).ast)
made the problem go away, is it still the case ?
It does give me some insight on the problem (AST copying is not behaving correctly in some cases)
the problem is that the copying is absolutely necessary, it could ba a workaround for you, but the real cure is to fix the copying.
so a reproduction case would be precious to have in the test suite.
on 2012-01-11 17:17 *
By sam.hendley
Hi Max, I worked on this for a while last night and determined that in our case the bug is only triggered if the inner select query has already been executed. We were building a result set recursively using the result of the previous query to get the id's of the next level down in the tree (even though we had already looked at the results). The SubQueryTests I added for the other bug we found build the exact same query in a single pass and that works correctly. I tried executing different parts of the same query before constructing the final query but I couldn't trigger the bug in isolation. Hopefully it will occur for someone else in a simpler to boil down situation.
I realized the triggering feature in our code should never have been there at all, our queries were taking longer and longer because instead of passing in the ids we have already looked up, we were doing a sub-select to get those ids. I can stop this bug from popping up and increase the overall query speed by passing in the ids manually. That allowed me to upgrade to RC1 (and get the transaction(session) call I really wanted).
Our project is open source if you want to see the bug in its natural habit, I can point you (via email) to the commit before the workaround that displays the bug.
I realized the triggering feature in our code should never have been there at all, our queries were taking longer and longer because instead of passing in the ids we have already looked up, we were doing a sub-select to get those ids. I can stop this bug from popping up and increase the overall query speed by passing in the ids manually. That allowed me to upgrade to RC1 (and get the transaction(session) call I really wanted).
Our project is open source if you want to see the bug in its natural habit, I can point you (via email) to the commit before the workaround that displays the bug.
on 2012-01-11 17:31 *
By maxime.levesque
If you can point to a git repo at a particular commit of the change that makes it go away, Ill certainly look at it.
Thanks
2012/1/11 Sam Hendley squeryl@alerts.assembla.com
Thanks
2012/1/11 Sam Hendley squeryl@alerts.assembla.com