Reuse code for optimizations

master
Salvo 'LtWorf' Tomaselli 2020-06-18 17:12:57 +07:00
parent 8fd2db12b5
commit 3056dafbff
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 1 additions and 3 deletions

@ -150,7 +150,7 @@ class Node:
elif isinstance(self, Binary) and self.name == DIVISION: elif isinstance(self, Binary) and self.name == DIVISION:
return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels))) return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels)))
elif self.name == PROJECTION: elif self.name == PROJECTION:
return [i.strip() for i in self.prop.split(',')] return self.get_projection_prop()
elif self.name == PRODUCT: elif self.name == PRODUCT:
return self.left.result_format(rels) + self.right.result_format(rels) return self.left.result_format(rels) + self.right.result_format(rels)
elif self.name == SELECTION: elif self.name == SELECTION:
@ -270,8 +270,6 @@ class Unary(Node):
self.prop = ','.join(f'{k}{ARROW}{v}' for k, v in renames.items()) self.prop = ','.join(f'{k}{ARROW}{v}' for k, v in renames.items())
def parse_tokens(expression: List[Union[list, str]]) -> Node: def parse_tokens(expression: List[Union[list, str]]) -> Node:
'''Generates the tree from the tokenized expression '''Generates the tree from the tokenized expression
If no expression is specified then it will create an empty node''' If no expression is specified then it will create an empty node'''