selection_inside_projection
This commit is contained in:
parent
418e293c1d
commit
6622ba947e
@ -202,20 +202,18 @@ def duplicated_projection(n: parser.Node) -> Tuple[parser.Node, int]:
|
|||||||
return n, 0
|
return n, 0
|
||||||
|
|
||||||
|
|
||||||
def selection_inside_projection(n: parser.Node) -> int:
|
def selection_inside_projection(n: parser.Node) -> Tuple[parser.Node, int]:
|
||||||
'''This function locates things like σ j (π k(R)) and
|
'''This function locates things like σ j (π k(R)) and
|
||||||
converts them into π k(σ j (R))'''
|
converts them into π k(σ j (R))'''
|
||||||
changes = 0
|
|
||||||
|
|
||||||
if n.name == SELECTION and n.child.name == PROJECTION:
|
if n.name == SELECTION and n.child.name == PROJECTION:
|
||||||
changes = 1
|
child = parser.Unary(
|
||||||
temp = n.prop
|
SELECTION,
|
||||||
n.prop = n.child.prop
|
n.prop,
|
||||||
n.child.prop = temp
|
n.child.child
|
||||||
n.name = PROJECTION
|
)
|
||||||
n.child.name = SELECTION
|
|
||||||
|
|
||||||
return changes + recoursive_scan(selection_inside_projection, n)
|
return parser.Unary(PROJECTION, n.child.prop, child), 0
|
||||||
|
return n, 0
|
||||||
|
|
||||||
|
|
||||||
def swap_union_renames(n: parser.Node) -> int:
|
def swap_union_renames(n: parser.Node) -> int:
|
||||||
@ -663,7 +661,7 @@ general_optimizations = [
|
|||||||
duplicated_select,
|
duplicated_select,
|
||||||
down_to_unions_subtractions_intersections,
|
down_to_unions_subtractions_intersections,
|
||||||
duplicated_projection,
|
duplicated_projection,
|
||||||
#selection_inside_projection,
|
selection_inside_projection,
|
||||||
#subsequent_renames,
|
#subsequent_renames,
|
||||||
#swap_rename_select,
|
#swap_rename_select,
|
||||||
futile_union_intersection_subtraction,
|
futile_union_intersection_subtraction,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user