@@ -130,9 +130,14 @@ testPushDownRestrictionPredicate = TestCase $ do
130 Right rel -> pure rel
130 Right rel -> pure rel
131 let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
131 let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
132 status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
132 status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
133+ relationsOrError = do
134+ stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
135+ let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
136+ status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
134− expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
138+ expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
135− assertEqual "union restriction pushdown" expectedExpr1 (applyStaticRestrictionPushdown expr1)
139+ pure $ (expectedExpr1, (applyStaticRestrictionPushdown expr1))
140+ either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
137 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
142 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
138 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
143 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
@@ -144,4 +149,4 @@ testPushDownRestrictionPredicate = TestCase $ do
144 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
149 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
145 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
150 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
146 projAttrs3 = AttributeNames (S.singleton "sname")
151 projAttrs3 = AttributeNames (S.singleton "sname")
147− assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)
152+ assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)