Package com.odiago.flumebase.exec

Examples of com.odiago.flumebase.exec.AssignedSymbol


    flowSpec.addNodesFromDAG(rightContext.getFlowSpec());
   
    // Get the true field names that represent keys on the left and right
    // sides of the join.
    String leftName = leftSrc.getSourceName();
    AssignedSymbol leftSym = (AssignedSymbol) getLeftKey().resolveAliases();
    TypedField leftKey = new TypedField(leftSym.getAssignedName(), leftSym.getType());

    String rightName = rightSrc.getSourceName();
    AssignedSymbol rightSym = (AssignedSymbol) getRightKey().resolveAliases();
    TypedField rightKey = new TypedField(rightSym.getAssignedName(), rightSym.getType());

    WindowSpec window = null;
    try {
      // This should evaluate to itself, but make sure to resolve it anyway.
      assert mWindowExpr.isConstant();
View Full Code Here


    for (TypedField field : streamSym.getFields()) {
      String fieldName = field.getUserAlias();

      // This field is available as 'streamName.fieldName'.
      String fullName = streamAlias + "." + fieldName;
      AssignedSymbol sym = new AssignedSymbol(fullName, field.getType(), "__f_" + nextId + "_",
          IdentifierExpr.AccessType.FIELD);
      sym.setParentName(streamAlias);
      nextId++;
      outTable.addSymbol(sym);

      // And also as an alias of just the fieldName.
      outTable.addSymbol(new AliasSymbol(fieldName, sym));
View Full Code Here

    // Create an Avro output schema for this node, specifying all the fields
    // we can emit.  Use our internal symbol (mSymbols a.k.a. outTable) to
    // create more precise TypedFields that use the proper avro names.
    List<TypedField> outFields = new ArrayList<TypedField>();
    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);
View Full Code Here

    }
  }

  @Override
  public void visit(IdentifierExpr ident) {
    AssignedSymbol assignedSym = ident.getAssignedSymbol();

    if (assignedSym instanceof WindowSymbol) {
      // We have found an IdentifierExpr that should be replaced.
      WindowSymbol windowSym = (WindowSymbol) assignedSym;
      mReplaceWith = windowSym.getWindowSpec();
View Full Code Here

  @Test
  public void testIdentifier() throws VisitException {
    // Test that we can look up an identifier in the symbol table.
    SymbolTable symbols = new HashSymbolTable();
    symbols.addSymbol(new AssignedSymbol("x", Type.getPrimitive(Type.TypeName.INT), "x",
        IdentifierExpr.AccessType.FIELD));

    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add, new IdentifierExpr("x"));
View Full Code Here

  @Test
  public void testIdentifierPromotion() throws VisitException {
    // Test that an identifier's type can promote to a constant.
    SymbolTable symbols = new HashSymbolTable();
    symbols.addSymbol(new AssignedSymbol("x", Type.getPrimitive(Type.TypeName.INT), "x",
        IdentifierExpr.AccessType.FIELD));

    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.BIGINT), Integer.valueOf(2)),
      BinOp.Add, new IdentifierExpr("x"));
View Full Code Here

  @Test
  public void testIdentifierPromotion2() throws VisitException {
    // Test that a const's type can promote to an identifier's.
    SymbolTable symbols = new HashSymbolTable();
    symbols.addSymbol(new AssignedSymbol("x", Type.getPrimitive(Type.TypeName.BIGINT), "x",
        IdentifierExpr.AccessType.FIELD));

    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.INT), Integer.valueOf(2)),
      BinOp.Add, new IdentifierExpr("x"));
View Full Code Here

   * the former, if streamName is not null.  </p>
   */
  private void createSymbols(SymbolTable symtab, String streamName, String fieldName,
      String assignedName, Type type) {
    if (null != streamName) {
      AssignedSymbol sym = new AssignedSymbol(streamName + "." + fieldName,
          type, assignedName, IdentifierExpr.AccessType.FIELD);
      sym.setParentName(streamName);
      symtab.addSymbol(sym);
      symtab.addSymbol(new AliasSymbol(fieldName, sym));
    } else {
      symtab.addSymbol(new AssignedSymbol(fieldName, type, assignedName,
          IdentifierExpr.AccessType.FIELD));
    }
  }
View Full Code Here

    if (null == fieldSym) {
      // This isn't just a simple field. Check if it's an attribute.
      if (fieldName.startsWith("#") && fieldName.length() > 1) {
        // This is an attribute name.
        String attrName = fieldName.substring(1);
        fieldSym = new AssignedSymbol(attrName,
            Type.getNullable(Type.TypeName.BINARY),
            attrName, IdentifierExpr.AccessType.ATTRIBUTE);
      } else if (isAmbiguousAlias(fieldName, fieldsSymTab)) {
        // The identifier doesn't exist, or else it's an ambiguous alias.
        // Return the appropriate error message.
View Full Code Here

    Ref<AssignedSymbol> symRef = new Ref<AssignedSymbol>();
    Ref<Type> typeRef = new Ref<Type>();
    resolveIdentifier(fieldsSymTab, fieldName, symRef, typeRef);

    Type fieldType = typeRef.item;
    AssignedSymbol fieldSym = symRef.item;

    // Let the AST node memoize its typing information from the symbol table;
    // it will need to reference this at run time to look up values from the
    // EventWrapper.
    e.setType(fieldType);
    e.setAssignedName(fieldSym.getAssignedName());
    e.setAccessType(fieldSym.getAccessType());
    e.setAssignedSymbol(fieldSym);
  }
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.exec.AssignedSymbol

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.