@@ -45,23 +45,16 @@ applyStaticRelationalOptimization (Union exprA exprB) = do
45 return $ Right $ Union optExprAx optExprBx
45 return $ Right $ Union optExprAx optExprBx
47applyStaticRelationalOptimization (Join exprA exprB) = do
47applyStaticRelationalOptimization (Join exprA exprB) = do
48− typeA <- typeForRelationalExpr exprA
48+ optExprA <- applyStaticRelationalOptimization exprA
49− typeB <- typeForRelationalExpr exprB
49+ optExprB <- applyStaticRelationalOptimization exprB
50− case typeA of
50+ case optExprA of
51 Left err -> return $ Left err
51 Left err -> return $ Left err
52− Right typeA2 -> case typeB of
52+ Right optExprA2 -> case optExprB of
53 Left err -> return $ Left err
53 Left err -> return $ Left err
54− Right typeB2 -> if typeA2 == typeB2 then --no new attributes to add
54+ Right optExprB2 -> if optExprA == optExprB then --A join A == A
55− return $ Right exprA
55+ return optExprA
57− optExprA <- applyStaticRelationalOptimization exprA
58− optExprB <- applyStaticRelationalOptimization exprB
61− Left err -> return $ Left err
62− Right optExprA2 -> case optExprB of
63− Left err -> return $ Left err
64− Right optExprB2 -> return $ Right (Join optExprA2 optExprB2)
57+ return $ Right (Join optExprA2 optExprB2)
66applyStaticRelationalOptimization e@(Rename _ _ _) = return $ Right e
59applyStaticRelationalOptimization e@(Rename _ _ _) = return $ Right e