def to_AST(self): mask = Mask.from_keylen(len(self.lhs) - 1) keyvars = self.lhs[:-1] var = self.lhs[-1] sm = L.SMLookup(L.ln(self.rel), mask.make_node().s, L.tuplify(keyvars), None) return L.Enumerator(L.sn(var), L.Set((sm, )))
def to_AST(self): mask = Mask.from_keylen(len(self.lhs) - 1) keyvars = self.lhs[:-1] var = self.lhs[-1] sm = L.SMLookup(L.ln(self.rel), mask.make_node().s, L.tuplify(keyvars), None) return L.Enumerator(L.sn(var), L.Set((sm,)))
def __init__(self, aggr, spec, name, demname, uset_lru, half_demand): self.params = params = tuple(spec.params) """Aggregate parameters (same as operand parameters). Also same as aggregate demand parameters. """ self.aggrmask = Mask.from_keylen(len(params)) """Aggregate result retrieval mask.""" self.oper_deltamask = spec.relmask.make_delta_mask() """Mask for doing delta test upon change to aggregate operand.""" assert not (spec.has_oper_demand and not self.has_demand), \ 'Can\'t have non-demand-driven aggregate over demand-driven ' \ 'operand' assert not (half_demand and not self.has_demand), \ 'Can\'t use half-demand strategy when not using demand at all'
def from_AST(cls, node, factory): """Construct from an Enumerator node of form var in {<rel>.smlookup(<mask>, <key vars>)} """ checktype(node, L.Enumerator) var = L.get_name(node.target) sm = L.get_singletonset(node.iter) checktype(sm, L.SMLookup) rel = L.get_name(sm.target) mask = Mask(sm.mask) keyvars = L.get_vartuple(sm.key) # Ensure the mask is consistent with how it's used. if mask != Mask.from_keylen(len(keyvars)): raise TypeError lhs = keyvars + (var, ) return cls(lhs, rel)
def from_AST(cls, node, factory): """Construct from an Enumerator node of form var in {<rel>.smlookup(<mask>, <key vars>)} """ checktype(node, L.Enumerator) var = L.get_name(node.target) sm = L.get_singletonset(node.iter) checktype(sm, L.SMLookup) rel = L.get_name(sm.target) mask = Mask(sm.mask) keyvars = L.get_vartuple(sm.key) # Ensure the mask is consistent with how it's used. if mask != Mask.from_keylen(len(keyvars)): raise TypeError lhs = keyvars + (var,) return cls(lhs, rel)