Improved futile_union_intersection_subtraction in case of A-A, when A is a sub-query
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@208 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
9efc56269e
commit
1d6aa88805
@ -90,4 +90,5 @@
|
|||||||
- Selection can now accept expressions with parenthesis
|
- Selection can now accept expressions with parenthesis
|
||||||
|
|
||||||
0.11
|
0.11
|
||||||
- Font is set only on windows (Rev 206)
|
- Font is set only on windows (Rev 206)
|
||||||
|
- Improved futile_union_intersection_subtraction in case of A-A, when A is a sub-query (Rev 208)
|
@ -81,8 +81,11 @@ def duplicated_select(n):
|
|||||||
|
|
||||||
def futile_union_intersection_subtraction(n):
|
def futile_union_intersection_subtraction(n):
|
||||||
'''This function locates things like r ᑌ r, and replaces them with r.
|
'''This function locates things like r ᑌ r, and replaces them with r.
|
||||||
σ k (r) ᑌ r with r
|
R ᑌ R --> R
|
||||||
σ k (r) ᑎ r with σ k (r)
|
R ᑎ R --> R
|
||||||
|
R - R --> σ False (R)
|
||||||
|
σ k (R) ᑌ R --> R
|
||||||
|
σ k (R) ᑎ R --> σ k (R)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
changes=0
|
changes=0
|
||||||
@ -109,7 +112,7 @@ def futile_union_intersection_subtraction(n):
|
|||||||
n.kind=optimizer.UNARY
|
n.kind=optimizer.UNARY
|
||||||
n.name='σ'
|
n.name='σ'
|
||||||
n.prop='False'
|
n.prop='False'
|
||||||
n.child=n.left
|
n.child=n.left.get_first_leaf()
|
||||||
#n.left=n.right=None
|
#n.left=n.right=None
|
||||||
|
|
||||||
return changes+recoursive_scan(futile_union_intersection_subtraction,n)
|
return changes+recoursive_scan(futile_union_intersection_subtraction,n)
|
||||||
|
@ -105,6 +105,16 @@ class node (object):
|
|||||||
else:
|
else:
|
||||||
return self.name
|
return self.name
|
||||||
pass
|
pass
|
||||||
|
def get_first_leaf(self):
|
||||||
|
'''This function returns the most left random leaf in the tree. It is needed by some optimizations.'''
|
||||||
|
if self.kind==RELATION:
|
||||||
|
return self
|
||||||
|
elif self.kind==UNARY:
|
||||||
|
return self.child.get_first_leaf()
|
||||||
|
elif self.kind==BINARY:
|
||||||
|
return self.left.get_first_leaf()
|
||||||
|
|
||||||
|
|
||||||
def result_format(self,rels):
|
def result_format(self,rels):
|
||||||
'''This function returns a list containing the fields that the resulting relation will have.
|
'''This function returns a list containing the fields that the resulting relation will have.
|
||||||
Since it needs to know real instances of relations, it requires a dictionary where keys are
|
Since it needs to know real instances of relations, it requires a dictionary where keys are
|
||||||
|
Loading…
Reference in New Issue
Block a user