on master help sign in
fix broken static optimizer test
1123834AgentM
test/Relation/StaticOptimizer.hs+3−2
@@ -124,11 +124,12 @@ testPushDownRestrictionPredicate :: Test
124testPushDownRestrictionPredicate = TestCase $ do
124testPushDownRestrictionPredicate = TestCase $ do
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
126 let rvs = RelationVariable "s" ()
126 let rvs = RelationVariable "s" ()
127− let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
128− status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
127+ let status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
129 relationsOrError = do
128 relationsOrError = do
130 stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
129 stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
131 let expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
130 let expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
131+ expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
132+
132 pure (expectedExpr1, applyStaticRestrictionPushdown expr1)
133 pure (expectedExpr1, applyStaticRestrictionPushdown expr1)
133 either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
134 either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
134
135