Package com.odiago.flumebase.parser

Examples of com.odiago.flumebase.parser.Expr


    before(s, s.getSource());
    s.getSource().accept(this);
    after(s, s.getSource());

    Expr where = s.getWhereConditions();
    if (null != where) {
      before(s, where);
      where.accept(this);
      after(s, where);
    }

    GroupBy groupBy = s.getGroupBy();
    if (null != groupBy) {
      before(s, groupBy);
      groupBy.accept(this);
      after(s, groupBy);
    }

    Expr aggregateOver = s.getWindowOver();
    if (null != aggregateOver) {
      before(s, aggregateOver);
      aggregateOver.accept(this);
      after(s, aggregateOver);
    }

    Expr having = s.getHaving();
    if (null != having) {
      before(s, having);
      having.accept(this);
      after(s, having);
    }

    List<WindowDef> windowDefs = s.getWindowDefs();
    if (null != windowDefs) {
View Full Code Here


  @Override
  protected void visit(FnCallExpr e) throws VisitException {
    List<Expr> args = e.getArgExpressions();
    if (null != args) {
      for (int i = 0; i < args.size(); i++) {
        Expr ae = args.get(i);
        before(e, ae);
        ae.accept(this);
        after(e, ae);
      }
    }
  }
View Full Code Here

    mAggregateExprs = null;

    // Now visit the where clause; no aggregates allowed there.
    mDisallowAggregates++;
    Expr where = s.getWhereConditions();
    if (null != where) {
      where.accept(this);
    }
    mDisallowAggregates--;


    // Visit the rest of the SELECT statement, including its upstream
View Full Code Here

  @Override
  protected void visit(AliasedExpr e) throws VisitException {
    // Check if the underlying expression is a function call to an aggregate fn.

    Expr subExpr = e.getExpr();
    boolean disallowedInChildren = false;
    if (subExpr instanceof FnCallExpr) {
      FnCallExpr fnCall = (FnCallExpr) subExpr;
      if (fnCall.isAggregate()) {
        // Yep, it's an aggregate function. Mark this aliasedExpr for aggregation step.
View Full Code Here

    if (!e.getOp().equals(BinOp.Eq)) {
      // Don't currently know how to handle non-equijoins.
      throw new VisitException("Join should be performed with the '=' operator.");
    }

    Expr e1 = e.getLeftExpr();
    Expr e2 = e.getRightExpr();

    assert e1 != null;
    assert e2 != null;

    if (!(e1 instanceof IdentifierExpr)) {
View Full Code Here

    }
  }

  @Override
  protected void visit(JoinedSource src) throws VisitException {
    Expr joinExpr = src.getJoinExpr();
    if (!(joinExpr instanceof BinExpr)) {
      // Need a BinExpr here.. don't know how to handle other top-level
      // expressions.
      throw new VisitException("Join should be performed with binary comparison operation");
    }
View Full Code Here

public class TestTypeChecker {

  @Test
  public void testBasicBinop() throws VisitException {
    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add, new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(3)));
    TypeChecker tc = new TypeChecker(new HashSymbolTable());
    binopExpr.accept(tc);
  }
View Full Code Here

    binopExpr.accept(tc);
  }

  @Test
  public void testNestedBinop() throws VisitException {
    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add,
      new BinExpr(
        new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(3)),
        BinOp.Add,
        new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(4))));

    TypeChecker tc = new TypeChecker(new HashSymbolTable());
    binopExpr.accept(tc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = VisitException.class)
  public void testBasicBinopFail() throws VisitException {
    // can't add INT and TIMESTAMP.
    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add, new ConstExpr(Type.getPrimitive(Type.TypeName.TIMESTAMP), Integer.valueOf(3)));
    TypeChecker tc = new TypeChecker(new HashSymbolTable());
    binopExpr.accept(tc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = VisitException.class)
  public void testNestedBinopFail() throws VisitException {
    // can't add INT and TIMESTAMP in a subexpr.
    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add,
      new BinExpr(
        new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(3)),
        BinOp.Add,
        new ConstExpr(Type.getPrimitive(Type.TypeName.TIMESTAMP), Integer.valueOf(4))));

    TypeChecker tc = new TypeChecker(new HashSymbolTable());
    binopExpr.accept(tc);
  }
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.parser.Expr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.