Check instance once
This commit is contained in:
parent
79610ab8f5
commit
9f171fa393
@ -147,29 +147,32 @@ 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):
|
||||||
return self.left.result_format(rels)
|
if self.name in (DIFFERENCE, UNION, INTERSECTION):
|
||||||
elif isinstance(self, Binary) and self.name == DIVISION:
|
return self.left.result_format(rels)
|
||||||
return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels)))
|
elif self.name == DIVISION:
|
||||||
elif self.name == PROJECTION:
|
return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels)))
|
||||||
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):
|
||||||
elif self.name == SELECTION:
|
return list(set(self.left.result_format(rels)).union(set(self.right.result_format(rels))))
|
||||||
return self.child.result_format(rels)
|
elif isinstance(self, Unary):
|
||||||
elif self.name == RENAME:
|
if self.name == PROJECTION:
|
||||||
_vars = {}
|
return self.get_projection_prop()
|
||||||
for i in self.prop.split(','):
|
elif self.name == SELECTION:
|
||||||
q = i.split(ARROW)
|
return self.child.result_format(rels)
|
||||||
_vars[q[0].strip()] = q[1].strip()
|
elif self.name == RENAME:
|
||||||
|
_vars = {}
|
||||||
|
for i in self.prop.split(','):
|
||||||
|
q = i.split(ARROW)
|
||||||
|
_vars[q[0].strip()] = q[1].strip()
|
||||||
|
|
||||||
|
_fields = self.child.result_format(rels)
|
||||||
|
for i in range(len(_fields)):
|
||||||
|
if _fields[i] in _vars:
|
||||||
|
_fields[i] = _vars[_fields[i]]
|
||||||
|
return _fields
|
||||||
|
|
||||||
_fields = self.child.result_format(rels)
|
|
||||||
for i in range(len(_fields)):
|
|
||||||
if _fields[i] in _vars:
|
|
||||||
_fields[i] = _vars[_fields[i]]
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user