Package com.odiago.flumebase.parser

Examples of com.odiago.flumebase.parser.Expr


    GenericData.Record record = new GenericData.Record(getOutputSchema());

    // Evaluate all our input expressions, left-to-right, and emit
    // their results into the output record.
    for (AliasedExpr aliasedExpr : mExprs) {
      Expr expr = aliasedExpr.getExpr();
      Object result = nativeToAvro(expr.eval(e), expr.getResolvedType());
      String fieldName = aliasedExpr.getAvroLabel();
      record.put(fieldName, result);
    }

    // Now add to our output record, any fields that we can pull in directly from
View Full Code Here


    mAggregateExprs = aggregateNode.getAggregateExprs();
    assert mAggregateExprs != null;
    mPropagateFields = aggregateNode.getPropagateFields();

    Expr windowExpr = aggregateNode.getWindowExpr();
    assert windowExpr.isConstant();
    try {
      mWindowSpec = (WindowSpec) windowExpr.eval(new EmptyEventWrapper());
      assert mWindowSpec.getRangeSpec().isConstant();
      mTimeSpan = (TimeSpan) mWindowSpec.getRangeSpec().eval(new EmptyEventWrapper());
    } catch (IOException ioe) {
      // The only way this can be thrown is if the window expr isn't actually constant.
      // This should not happen due to the assert above..
View Full Code Here

    // For each aggregation function we're performing, insert this event into
    // the bucket for the aggregate function.
    assert buckets.size() == mAggregateExprs.size();
    for (int i = 0; i < mAggregateExprs.size(); i++ ) {
      AliasedExpr aliasExpr = mAggregateExprs.get(i);
      Expr expr = aliasExpr.getExpr();
      assert expr instanceof FnCallExpr;
      FnCallExpr fnCall = (FnCallExpr) expr;
      Bucket bucket = buckets.get(i);
      fnCall.insertAggregate(e, bucket);
    }
View Full Code Here

 
  /**
   * Set the avro label by which we refer to the result of this expression.
   */
  private void setAvroLabel(AliasedExpr ae) {
    Expr e = ae.getExpr();
    if (e instanceof IdentifierExpr) {
      //  Delay setting avro labels for IdentifierExprs; the type checking
      //  phase will provide us with source labels that are set as the
      //  avro labels for the encompassing AliasedExprs.
      //  The exception are '#idents' which are either magic keys or attributes.
View Full Code Here

    SQLStatement src = s.getSource();
    if (mOldChild == src) {
      s.setSource(mNewChild);
    }

    Expr where = s.getWhereConditions();
    if (mOldChild == where) {
      s.setWhereConditions((Expr) mNewChild);
    }

    GroupBy groupBy = s.getGroupBy();
    if (mOldChild == groupBy) {
      s.setGroupBy((GroupBy) mNewChild);
    }

    Expr aggregateOver = s.getWindowOver();
    if (mOldChild == aggregateOver) {
      s.setWindowOver((Expr) mNewChild);
    }

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

    super.visit(s);
  }

  @Override
  protected void visit(BinExpr e) throws VisitException {
    Expr left = e.getLeftExpr();
    if (mOldChild == left) {
      e.setLeftExpr((Expr) mNewChild);
    }

    Expr right = e.getRightExpr();
    if (mOldChild == right) {
      e.setRightExpr((Expr) mNewChild);
    }

    super.visit(e);
View Full Code Here

    super.visit(e);
  }

  @Override
  protected void visit(UnaryExpr e) throws VisitException {
    Expr child = e.getSubExpr();
    if (mOldChild == child) {
      e.setSubExpr((Expr) mNewChild);
    }

    super.visit(e);
View Full Code Here

    super.visit(e);
  }

  @Override
  protected void visit(AliasedExpr e) throws VisitException {
    Expr child = e.getExpr();
    if (mOldChild == child) {
      e.setExpr((Expr) mNewChild);
    }
    super.visit(e);
  }
View Full Code Here

    super.visit(e);
  }

  @Override
  protected void visit(RangeSpec e) throws VisitException {
    Expr prev = e.getPrevSize();
    Expr after = e.getAfterSize();

    if (mOldChild == prev) {
      e.setPrevSize((Expr) mNewChild);
    }
View Full Code Here

  @Override
  protected void visit(JoinedSource s) throws VisitException {
    RecordSource left = s.getLeft();
    RecordSource right = s.getRight();
    Expr join = s.getJoinExpr();
    Expr window = s.getWindowExpr();

    if (mOldChild == left) {
      s.setLeft((RecordSource) mNewChild);
    }
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.