on master help sign in
fix StaticOptimizer tests
0fc9e09Diogo Biazus
test/Relation/StaticOptimizer.hs+5−4
@@ -128,10 +128,11 @@ testPushDownRestrictionPredicate = TestCase $ do
128 [TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]] of
128 [TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]] of
129 Left err -> assertFailure ("stevens relation: " ++ show err) >> pure relationTrue
129 Left err -> assertFailure ("stevens relation: " ++ show err) >> pure relationTrue
130 Right rel -> pure rel
130 Right rel -> pure rel
131+ let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
132+ status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
131
133
132− expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
134+ expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
133− pure (expectedExpr1, applyStaticRestrictionPushdown expr1)
135+ assertEqual "union restriction pushdown" expectedExpr1 (applyStaticRestrictionPushdown expr1)
134− either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
135
136
136 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
137 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
137 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
138 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
@@ -143,4 +144,4 @@ testPushDownRestrictionPredicate = TestCase $ do
143 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
144 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
144 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
145 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
145 projAttrs3 = AttributeNames (S.singleton "sname")
146 projAttrs3 = AttributeNames (S.singleton "sname")
146− assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)
147+ assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)