Enable down_to_unions_subtractions_intersections
This commit is contained in:
parent
403b7b9962
commit
418e293c1d
@ -175,7 +175,7 @@ def futile_union_intersection_subtraction(n: parser.Node) -> Tuple[parser.Node,
|
|||||||
return n, 0
|
return n, 0
|
||||||
|
|
||||||
|
|
||||||
def down_to_unions_subtractions_intersections(n: parser.Node) -> int:
|
def down_to_unions_subtractions_intersections(n: parser.Node) -> Tuple[parser.Node, int]:
|
||||||
'''This funcion locates things like σ i==2 (c ᑌ d), where the union
|
'''This funcion locates things like σ i==2 (c ᑌ d), where the union
|
||||||
can be a subtraction and an intersection and replaces them with
|
can be a subtraction and an intersection and replaces them with
|
||||||
σ i==2 (c) ᑌ σ i==2(d).
|
σ i==2 (c) ᑌ σ i==2(d).
|
||||||
@ -183,27 +183,11 @@ def down_to_unions_subtractions_intersections(n: parser.Node) -> int:
|
|||||||
changes = 0
|
changes = 0
|
||||||
_o = (UNION, DIFFERENCE, INTERSECTION)
|
_o = (UNION, DIFFERENCE, INTERSECTION)
|
||||||
if n.name == SELECTION and n.child.name in _o:
|
if n.name == SELECTION and n.child.name in _o:
|
||||||
|
l = parser.Unary(SELECTION, n.prop, n.child.left)
|
||||||
|
r = parser.Unary(SELECTION, n.prop, n.child.right)
|
||||||
|
|
||||||
left = parser.Node()
|
return parser.Binary(n.child.name, l, r), 1
|
||||||
left.prop = n.prop
|
return n, 0
|
||||||
left.name = n.name
|
|
||||||
left.child = n.child.left
|
|
||||||
left.kind = parser.UNARY
|
|
||||||
right = parser.Node()
|
|
||||||
right.prop = n.prop
|
|
||||||
right.name = n.name
|
|
||||||
right.child = n.child.right
|
|
||||||
right.kind = parser.UNARY
|
|
||||||
|
|
||||||
n.name = n.child.name
|
|
||||||
n.left = left
|
|
||||||
n.right = right
|
|
||||||
n.child = None
|
|
||||||
n.prop = None
|
|
||||||
n.kind = parser.BINARY
|
|
||||||
changes += 1
|
|
||||||
|
|
||||||
return changes + recoursive_scan(down_to_unions_subtractions_intersections, n)
|
|
||||||
|
|
||||||
|
|
||||||
def duplicated_projection(n: parser.Node) -> Tuple[parser.Node, int]:
|
def duplicated_projection(n: parser.Node) -> Tuple[parser.Node, int]:
|
||||||
@ -677,7 +661,7 @@ def useless_projection(n, rels) -> int:
|
|||||||
|
|
||||||
general_optimizations = [
|
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user