added selection_inside_projection

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@153 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2009-05-08 14:46:29 +00:00
parent 9627500a21
commit b3a9d98d24

View File

@ -78,6 +78,29 @@ def down_to_unions_subtractions_intersections(n):
changes+=down_to_unions_subtractions_intersections(n.right)
changes+=down_to_unions_subtractions_intersections(n.left)
return changes
general_optimizations=[duplicated_select,down_to_unions_subtractions_intersections]
def duplicated_projection(n):
'''This function locates thing like π i ( π j (R)) and replaces
them with π i (R)'''
changes=0
if n.name=='π' and n.child.name=='π':
n.child=n.child.child
changes+=1
#recoursive scan
if n.kind==optimizer.UNARY:
changes+=duplicated_projection(n.child)
elif n.kind==optimizer.BINARY:
changes+=duplicated_projection(n.right)
changes+=duplicated_projection(n.left)
return changes
def selection_inside_projection(n):
'''This function locates things like σ j (π k(R)) and
converts them into π k(σ j (R))'''
changes=0
return changes
general_optimizations=[duplicated_select,down_to_unions_subtractions_intersections,duplicated_projection,selection_inside_projection]