Package org.teiid.query.eval

Examples of org.teiid.query.eval.Evaluator


        ElementSymbol e1 = new ElementSymbol("e1"); //$NON-NLS-1$
        elementMap.put(e1, new Integer(0));
       
        List tuple = Arrays.asList(new String[]{"a"}); //$NON-NLS-1$
        CommandContext cc = new CommandContext();
        assertEquals(expectedResult, new Evaluator(elementMap, null, cc) {
          @Override
          protected ValueIterator evaluateSubquery(
              SubqueryContainer container, List tuple)
              throws TeiidProcessingException, BlockedException,
              TeiidComponentException {
View Full Code Here


    private QueryTupleSource(TupleBrowser browser, Map map,
        List<? extends SingleElementSymbol> projectedCols, Criteria condition) {
      this.browser = browser;
      this.indexes = RelationalNode.getProjectionIndexes(map, projectedCols);
      this.eval = new Evaluator(map, null, null);
      this.condition = condition;
      this.project = shouldProject();
      this.reserved = reserveBuffers();
      if (updatable) {
        lock.readLock().lock();
View Full Code Here

   
    protected TupleBuffer undoLog;

    UpdateProcessor(Criteria crit, TupleSource ts) throws TeiidComponentException {
      this.ts = ts;
      this.eval = new Evaluator(columnMap, null, null);
      this.crit = crit;
      this.undoLog = bm.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR);
    }
View Full Code Here

        Criteria actual = null;
        // rewrite
        try {
          ArrayList<Boolean> booleanVals = new ArrayList<Boolean>(tuples.size());
          for (List<Object> tuple : tuples) {
              booleanVals.add(new Evaluator(elements, null, null).evaluate(origCrit, tuple));
      }
            actual = QueryRewriter.rewriteCriteria(origCrit, null, null, metadata);
            assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
            for (int i = 0; i < tuples.size(); i++) {
              assertEquals(tuples.get(i).toString(), booleanVals.get(i), new Evaluator(elements, null, null).evaluate(actual, tuples.get(i)));
      }
        } catch(TeiidException e) {
          throw new RuntimeException(e);
        }
        return actual;
View Full Code Here

    private QueryRewriter(QueryMetadataInterface metadata,
      CommandContext context, CreateUpdateProcedureCommand procCommand) {
    this.metadata = metadata;
    this.context = context;
    this.procCommand = procCommand;
    this.evaluator = new Evaluator(Collections.emptyMap(), null, context);
  }
View Full Code Here

        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

      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

        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

        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

        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

TOP

Related Classes of org.teiid.query.eval.Evaluator

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.