From 3056dafbffec5036a3dc7f161c452a9517cb0f72 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 18 Jun 2020 17:12:57 +0200 Subject: [PATCH] Reuse code for optimizations --- relational/parser.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/relational/parser.py b/relational/parser.py index 16909af..f748e97 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -150,7 +150,7 @@ class Node: elif isinstance(self, Binary) and self.name == DIVISION: return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels))) elif self.name == PROJECTION: - return [i.strip() for i in self.prop.split(',')] + return self.get_projection_prop() elif self.name == PRODUCT: return self.left.result_format(rels) + self.right.result_format(rels) elif self.name == SELECTION: @@ -270,8 +270,6 @@ class Unary(Node): self.prop = ','.join(f'{k}{ARROW}{v}' for k, v in renames.items()) - - def parse_tokens(expression: List[Union[list, str]]) -> Node: '''Generates the tree from the tokenized expression If no expression is specified then it will create an empty node'''