- improved an optimization, to produce a simpler select condition under certain circumstances
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@343 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
cd85b7e1c1
commit
3978259f4a
@ -1,6 +1,7 @@
|
|||||||
1.2
|
1.2
|
||||||
- Better tokenizer, gives more indicative errors
|
- Better tokenizer, gives more indicative errors
|
||||||
- Parser gives more indicative errors
|
- Parser gives more indicative errors
|
||||||
|
- Improved select_union_intersect_subtract optimization to avoid parenthesis whenever possible
|
||||||
|
|
||||||
1.1
|
1.1
|
||||||
- Incorrect relational operations now raise an exception instead of returning None
|
- Incorrect relational operations now raise an exception instead of returning None
|
||||||
|
@ -475,7 +475,22 @@ def select_union_intersect_subtract(n):
|
|||||||
|
|
||||||
newnode=parser.node()
|
newnode=parser.node()
|
||||||
|
|
||||||
newnode.prop='((%s) %s (%s))' % (n.left.prop,op,n.right.prop)
|
if n.left.prop.startswith('(') or n.right.prop.startswith('('):
|
||||||
|
t_str='('
|
||||||
|
if n.left.prop.startswith('('):
|
||||||
|
t_str+='(%s)'
|
||||||
|
else:
|
||||||
|
t_str+='%s'
|
||||||
|
t_str+=' %s '
|
||||||
|
if n.right.prop.startswith('('):
|
||||||
|
t_str+='(%s)'
|
||||||
|
else:
|
||||||
|
t_str+='%s'
|
||||||
|
t_str+=')'
|
||||||
|
|
||||||
|
newnode.prop= t_str % (n.left.prop,op,n.right.prop)
|
||||||
|
else:
|
||||||
|
newnode.prop='%s %s %s' % (n.left.prop,op,n.right.prop)
|
||||||
newnode.name=SELECTION
|
newnode.name=SELECTION
|
||||||
newnode.child=n.left.child
|
newnode.child=n.left.child
|
||||||
newnode.kind=parser.UNARY
|
newnode.kind=parser.UNARY
|
||||||
|
1
test/select_join_opt.query
Normal file
1
test/select_join_opt.query
Normal file
@ -0,0 +1 @@
|
|||||||
|
σ skill=='C' and chief==0 ((σ age<30 (people) ᑌ σ age>40(people)) ᐅᐊ skills)
|
3
test/select_join_opt.result
Normal file
3
test/select_join_opt.result
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
id,name,chief,age,skill
|
||||||
|
0,jack,0,22,C
|
||||||
|
4,eve,0,25,C
|
Loading…
x
Reference in New Issue
Block a user