|
|
@ -147,14 +147,18 @@ class Node:
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(self, Variable): #FIXME this is ugly
|
|
|
|
if isinstance(self, Variable): #FIXME this is ugly
|
|
|
|
return list(rels[self.name].header)
|
|
|
|
return list(rels[self.name].header)
|
|
|
|
elif isinstance(self, Binary) and self.name in (DIFFERENCE, UNION, INTERSECTION):
|
|
|
|
elif isinstance(self, Binary):
|
|
|
|
|
|
|
|
if self.name in (DIFFERENCE, UNION, INTERSECTION):
|
|
|
|
return self.left.result_format(rels)
|
|
|
|
return self.left.result_format(rels)
|
|
|
|
elif isinstance(self, Binary) and self.name == DIVISION:
|
|
|
|
elif 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:
|
|
|
|
|
|
|
|
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 in (JOIN, JOIN_LEFT, JOIN_RIGHT, JOIN_FULL):
|
|
|
|
|
|
|
|
return list(set(self.left.result_format(rels)).union(set(self.right.result_format(rels))))
|
|
|
|
|
|
|
|
elif isinstance(self, Unary):
|
|
|
|
|
|
|
|
if self.name == PROJECTION:
|
|
|
|
|
|
|
|
return self.get_projection_prop()
|
|
|
|
elif self.name == SELECTION:
|
|
|
|
elif self.name == SELECTION:
|
|
|
|
return self.child.result_format(rels)
|
|
|
|
return self.child.result_format(rels)
|
|
|
|
elif self.name == RENAME:
|
|
|
|
elif self.name == RENAME:
|
|
|
@ -168,8 +172,7 @@ class Node:
|
|
|
|
if _fields[i] in _vars:
|
|
|
|
if _fields[i] in _vars:
|
|
|
|
_fields[i] = _vars[_fields[i]]
|
|
|
|
_fields[i] = _vars[_fields[i]]
|
|
|
|
return _fields
|
|
|
|
return _fields
|
|
|
|
elif self.name in (JOIN, JOIN_LEFT, JOIN_RIGHT, JOIN_FULL):
|
|
|
|
|
|
|
|
return list(set(self.left.result_format(rels)).union(set(self.right.result_format(rels))))
|
|
|
|
|
|
|
|
raise ValueError('What kind of alien object is this?')
|
|
|
|
raise ValueError('What kind of alien object is this?')
|
|
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other): #FIXME
|
|
|
|
def __eq__(self, other): #FIXME
|
|
|
|