Examples of Evaluator


Examples of org.teiid.query.eval.Evaluator

        if (valueList != null) {
            for(int i=0; i<valueList.length; i++) {
                tuple.add(valueList[i]);
            }
        }
        return new Evaluator(elements, dataMgr, context).evaluate(expr, tuple);
    }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

      List<?> values, Object expected)
      throws BlockedException,
      TeiidComponentException, ExpressionEvaluationException {
    final CollectionValueIterator valueIter = new CollectionValueIterator(values);
        CommandContext cc = new CommandContext();
        assertEquals(expected, new Evaluator(Collections.emptyMap(), null, cc) {
          @Override
          protected ValueIterator evaluateSubquery(
              SubqueryContainer container, List tuple)
              throws TeiidProcessingException, BlockedException,
              TeiidComponentException {
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

        func.setFunctionDescriptor(desc);

        FakeDataManager dataMgr = new FakeDataManager();
        CommandContext context = new CommandContext(new Long(1), null, null, null, 0);
        context.setUserName("logon")//$NON-NLS-1$
        assertEquals(context.getUserName(), new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList()) );      
    }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

        props.setProperty("http_host", "testHostName"); //$NON-NLS-1$ //$NON-NLS-2$
        props.setProperty("http_port", "8000"); //$NON-NLS-1$ //$NON-NLS-2$
        CommandContext context = new CommandContext(new Long(1), null, null, null, null, 0, props, false);
       
        func.setArgs(new Expression[] {new Constant("http_host")}); //$NON-NLS-1$
        assertEquals("testHostName", new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList())); //$NON-NLS-1$
              
        func.setArgs(new Expression[] {new Constant("http_port")}); //$NON-NLS-1$
        assertEquals("8000", new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList())); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

        CommandContext context = new CommandContext(new Long(-1), null, "user", payload, "vdb", 1, null, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

        if(property != null) {
            func.setArgs(new Expression[] {new Constant(property)});
        }
        String actual = (String) new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList());
        assertEquals(expectedValue, actual);
    }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

  }
 
  @Override
  public void initialize(JoinNode joinNode) {
    super.initialize(joinNode);
    this.eval = new Evaluator(null, joinNode.getDataManager(), joinNode.getContext());
  }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

    }
   
    public void open() throws TeiidComponentException, TeiidProcessingException {
      limit = -1;
      if (limitExpr != null) {
            Integer limitVal = (Integer)new Evaluator(Collections.emptyMap(), getDataManager(), getContext()).evaluate(limitExpr, Collections.emptyList());
            limit = limitVal.intValue();
      }
        if (limit == 0) {
          return;
        }
        if (offsetExpr != null) {
            Integer offsetVal = (Integer)new Evaluator(Collections.emptyMap(), getDataManager(), getContext()).evaluate(offsetExpr, Collections.emptyList());
            offset = offsetVal.intValue();
        } else {
            offset = 0;
        }
        offsetPhase = offset > 0;
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

            data.add(referenceValues.get(element));
            index++;
        }

        try {
      return new Evaluator(elementMap, env.getDataManager(), env.getProcessorContext()).evaluate(this.criteria, data);
    } catch (ExpressionEvaluationException e) {
            throw new TeiidComponentException(e);
    }
  }
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

              context.setVariableContext(this.contexts.get(i));
            }
            boolean needProcessing = false;
            if(shouldEvaluate != null && shouldEvaluate.get(i)) {
                updateCommand = (Command) updateCommand.clone();
                Evaluator eval = getEvaluator(Collections.emptyMap());
                eval.initialize(context, getDataManager());
                AccessNode.rewriteAndEvaluate(updateCommand, eval, context, context.getMetadata());
            }
            needProcessing = RelationalNodeUtil.shouldExecute(updateCommand, true);
            if (needProcessing) {
                commandsToExecute.add(updateCommand);
View Full Code Here

Examples of org.teiid.query.eval.Evaluator

   
    final RelationalNode sourceNode = this.getChildren()[0];
   
    return new BatchCollector.BatchProducerTupleSource(sourceNode) {
     
      Evaluator eval = new Evaluator(elementMap, getDataManager(), getContext());
     
      @Override
      protected List updateTuple(List tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
        int columns = collectedExpressions.size();
              List exprTuple = new ArrayList(columns);
              for(int col = 0; col<columns; col++) {
                  // The following call may throw BlockedException, but all state to this point
                  // is saved in class variables so we can start over on building this tuple
                  Object value = eval.evaluate(collectedExpressions.get(col), tuple);
                  exprTuple.add(value);
              }
              return exprTuple;
      }
    };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.