Beispiel #1
0
    def visit_FunctionCall(self, node):
        # FIXME: this is a temporary solution to bridge the gap to EdgeQL
        if node.agg_set_modifier == qlast.AggDISTINCT:
            args = qlast.UnaryOp(op=qlast.DISTINCT, operand=node.args[0])
        else:
            args = node.args

        # FIXME: hack to reconstruct args for a trivial aggregate function
        args = [qlast.FuncArg(arg=arg) for arg in self.visit(args)]
        if node.agg_filter or node.agg_sort:
            args[0].sort = node.agg_sort
            args[0].filter = (self.visit(node.agg_filter)
                              if node.agg_filter is not None else None)

        result = qlast.FunctionCall(
            func=(node.func.shortname.module, node.func.shortname.name),
            args=args,
        )

        return result
Beispiel #2
0
 def reduce_NOT_Expr(self, *kids):
     self.val = qlast.UnaryOp(op=ast.ops.NOT, operand=kids[1].val)
Beispiel #3
0
 def reduce_MINUS_Expr(self, *kids):
     self.val = qlast.UnaryOp(op=ast.ops.UMINUS, operand=kids[1].val)
Beispiel #4
0
 def reduce_DISTINCT_Expr(self, *kids):
     self.val = qlast.UnaryOp(op=qlast.DISTINCT, operand=kids[1].val)
Beispiel #5
0
 def visit_DistinctOp(self, node):
     result = qlast.UnaryOp()
     result.operand = self.visit(node.expr)
     result.op = qlast.DISTINCT
     return result
Beispiel #6
0
 def visit_UnaryOp(self, node):
     result = qlast.UnaryOp()
     result.operand = self.visit(node.expr)
     result.op = node.op
     return result