Package com.odiago.flumebase.plan

Examples of com.odiago.flumebase.plan.PlanNode


        allRequiredFields, groupByPropagateFields, exprPropagateFields,
        projectionInputs, projectionOutputs, consoleFields);

    if (where != null) {
      // Non-null filter conditions; apply the filter to all of our sources.
      PlanNode filterNode = new FilterNode(where);
      flowSpec.attachToLastLayer(filterNode);
    }

    // Add an aggregation layer, if required.
    addAggregationToPlan(srcOutSymbolTable, flowSpec, groupByPropagateFields);

    // Evaluate calculated-expression fields.
    addExpressionsToPlan(flowSpec, exprPropagateFields, projectionInputs);

    // Create the projected schema based on the symbol table returned by our source.
    Schema projectedSchema = createFieldSchema(distinctFields(projectionOutputs));
    ProjectionNode projectionNode = new ProjectionNode(projectionInputs, projectionOutputs);
    projectionNode.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, projectedSchema);
    flowSpec.attachToLastLayer(projectionNode);

    if (mHaving != null) {
      // Non-null HAVING conditions; apply another filter to our output.
      PlanNode havingNode = new FilterNode(mHaving);
      flowSpec.attachToLastLayer(havingNode);
    }

    return createReturnedContext(planContext, consoleFields);
  }
View Full Code Here


        aggregateOverFields = mGroupBy.getFieldTypes();
      }

      LOG.debug("Aggregate exprs: " + StringUtils.listToStr(mAggregateExprs));
      assert flowSpec.getConf() != null;
      PlanNode aggregateNode = new AggregateNode(aggregateOverFields,
          mAggregateOver, mAggregateExprs, groupByPropagateFields, flowSpec.getConf());
      flowSpec.attachToLastLayer(aggregateNode);

      // Output schema for this layer contains everything we need to forward
      // from our upstream layers...
      List<TypedField> aggOutputFields = new ArrayList<TypedField>();
      aggOutputFields.addAll(groupByPropagateFields);
      // As well as the names of everything we calculate in this layer.
      for (AliasedExpr aliasExpr : mAggregateExprs) {
        Expr e = aliasExpr.getExpr();
        Type t = e.getType(fieldSymbols);
        TypedField aggregateField = new TypedField(
          aliasExpr.getUserAlias(), t,
          aliasExpr.getAvroLabel(), aliasExpr.getDisplayLabel());
        aggOutputFields.add(aggregateField);
      }
      Schema aggregateOutSchema = createFieldSchema(aggOutputFields);
      aggregateNode.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, aggregateOutSchema);
    }
  }
View Full Code Here

        calculatedExprs.add(expr);
      }
    }

    if (calculatedExprs.size() > 0) {
      PlanNode exprNode = new EvaluateExprsNode(calculatedExprs, exprPropagateFields);
      // TODO(aaron): assert that calculatedExprs UNION exprPropagateFields gives
      // us the projectionInputs list.
      Schema exprOutSchema = createFieldSchema(projectionInputs);
      exprNode.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, exprOutSchema);
      flowSpec.attachToLastLayer(exprNode);
    }
  }
View Full Code Here

    for (String fieldName : fieldNames) {
      AssignedSymbol sym = (AssignedSymbol) outTable.resolve(fieldName).resolveAliases();
      outFields.add(new TypedField(fieldName, sym.getType(), sym.getAssignedName(), fieldName));
    }

    PlanNode node = new NamedSourceNode(mSourceName, outFields);
    planContext.getFlowSpec().addRoot(node);
    Schema outSchema = createFieldSchema(outFields);
    outContext.setSchema(outSchema);
    outContext.setOutFields(outFields);
    node.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, outSchema);

    return outContext;
  }
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.plan.PlanNode

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.