completed implementation of selection_inside_projection
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@154 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
b3a9d98d24
commit
c7f1aa060e
@ -74,3 +74,4 @@
|
||||
- Uses python-psyco when it is available
|
||||
- Ability to perform optimizations from GUI
|
||||
- Able to (temporarily) store queries with a name
|
||||
- Mechanism to add new kind of optimizations, without having to edit all the code
|
@ -101,6 +101,21 @@ def selection_inside_projection(n):
|
||||
'''This function locates things like σ j (π k(R)) and
|
||||
converts them into π k(σ j (R))'''
|
||||
changes=0
|
||||
|
||||
if n.name=='σ' and n.child.name=='π':
|
||||
changes=1
|
||||
temp=n.prop
|
||||
n.prop=n.child.prop
|
||||
n.child.prop=temp
|
||||
n.name='π'
|
||||
n.child.name='σ'
|
||||
|
||||
#recoursive scan
|
||||
if n.kind==optimizer.UNARY:
|
||||
changes+=selection_inside_projection(n.child)
|
||||
elif n.kind==optimizer.BINARY:
|
||||
changes+=selection_inside_projection(n.right)
|
||||
changes+=selection_inside_projection(n.left)
|
||||
return changes
|
||||
|
||||
general_optimizations=[duplicated_select,down_to_unions_subtractions_intersections,duplicated_projection,selection_inside_projection]
|
||||
general_optimizations=[duplicated_select,down_to_unions_subtractions_intersections,duplicated_projection,selection_inside_projection]
|
||||
|
Loading…
Reference in New Issue
Block a user