Enable duplicated_projection

master
Salvo 'LtWorf' Tomaselli 2020-06-09 11:45:35 +07:00
parent 50647294cb
commit 403b7b9962
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 7 additions and 7 deletions

@ -206,16 +206,16 @@ def down_to_unions_subtractions_intersections(n: parser.Node) -> int:
return changes + recoursive_scan(down_to_unions_subtractions_intersections, n) return changes + recoursive_scan(down_to_unions_subtractions_intersections, n)
def duplicated_projection(n: parser.Node) -> int: def duplicated_projection(n: parser.Node) -> Tuple[parser.Node, int]:
'''This function locates thing like π i ( π j (R)) and replaces '''This function locates thing like π i ( π j (R)) and replaces
them with π i (R)''' them with π i (R)'''
changes = 0
if n.name == PROJECTION and n.child.name == PROJECTION: if n.name == PROJECTION and n.child.name == PROJECTION:
n.child = n.child.child return parser.Unary(
changes += 1 PROJECTION,
n.prop,
return changes + recoursive_scan(duplicated_projection, n) n.child.child), 1
return n, 0
def selection_inside_projection(n: parser.Node) -> int: def selection_inside_projection(n: parser.Node) -> int:
@ -678,7 +678,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,
#swap_rename_select, #swap_rename_select,