Package com.odiago.flumebase.exec

Examples of com.odiago.flumebase.exec.HashSymbolTable


  @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


      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

  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

      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

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

  public void testPromotion2() throws VisitException {
    // Test that INT can promote to BIGINT on the lhs.
    Expr binopExpr = new BinExpr(
      new ConstExpr(Type.getPrimitive(Type.TypeName.BIGINT), 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

  }

  @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

    try {
      // Visit the window clauses first; if their types are okay, create a new
      // symbol table to use when visiting our sources, that contains the
      // window names.

      SymbolTable symbolsForSources = new HashSymbolTable(originalSymtab);
      List<WindowDef> windowDefs = s.getWindowDefs();
      for (WindowDef def : windowDefs) {
        def.accept(this);
        symbolsForSources.addSymbol(new WindowSymbol(def.getName(), def.getWindowSpec()));
      }
      mSymTableContext.push(symbolsForSources);
     
      // Now visit the sources, with the symbols for any windows pushed.
      SQLStatement source = s.getSource();
      visitValidSource(source);

      SymbolTable exprTable = mSymTableContext.top();
      outTable = new HashSymbolTable(originalSymtab);

      // The "stream name" representing this SELECT stmt in the parent
      // statement.
      String stmtAlias = s.getAlias();
      // Nested SELECT statements require an alias.
View Full Code Here

TOP

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

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.