Package org.teiid.common.buffer

Examples of org.teiid.common.buffer.TupleSource.nextTuple()


        TupleBuffer tsid = bm.createTupleBuffer(Arrays.asList(es1), "test", TupleSourceType.PROCESSOR); //$NON-NLS-1$
        tsid.addTuple(Arrays.asList(1));
      SortUtility su = new SortUtility(tsid.createIndexedTupleSource(), Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test", tsid.getSchema()); //$NON-NLS-1$
      TupleBuffer out = su.sort();
      TupleSource ts = out.createIndexedTupleSource();
      assertEquals(Arrays.asList(1), ts.nextTuple());
      try {
        ts.nextTuple();
        fail();
      } catch (BlockedException e) {
       
View Full Code Here


      SortUtility su = new SortUtility(tsid.createIndexedTupleSource(), Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test", tsid.getSchema()); //$NON-NLS-1$
      TupleBuffer out = su.sort();
      TupleSource ts = out.createIndexedTupleSource();
      assertEquals(Arrays.asList(1), ts.nextTuple());
      try {
        ts.nextTuple();
        fail();
      } catch (BlockedException e) {
       
      }
      tsid.addTuple(Arrays.asList(2));
View Full Code Here

       
      }
      tsid.addTuple(Arrays.asList(2));
      tsid.addTuple(Arrays.asList(3));
      su.sort();
      assertEquals(Arrays.asList(2), ts.nextTuple());
    }
   
}
View Full Code Here

                    }
              } else if (insert.getTupleSource() != null) {
                TupleSource ts = insert.getTupleSource();
                List tuple = null;
                int i = 0;
                while ((tuple = ts.nextTuple()) != null) {
                    ensureValue2(tuple, 2, ++i);
                }
                batchSize = i;
              } else {
                ensureValue(insert, 2, callCount);
View Full Code Here

       
        // Compare actual with expected results
        TupleSource actual = tsID.createIndexedTupleSource();
        if(expectedResults.length > 0) {
            for(int i=0; i<expectedResults.length; i++) {
                List actRecord = actual.nextTuple();
                List expRecord = expectedResults[i];                   
                assertEquals("Did not match row at row index " + i, expRecord, actRecord); //$NON-NLS-1$
            }
        }
        tsID.remove();
View Full Code Here

        metadata.getFullName(ids.iterator().next()) + " = ?" + ' ' + Reserved.OPTION + ' ' + Reserved.NOCACHE; //$NON-NLS-1$
      QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(queryString, matViewName.toUpperCase(), context, key.getValue());
      qp.setNonBlocking(true);
      qp.getContext().setDataObjects(null);
      TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
      List<?> tuple = ts.nextTuple();
      boolean delete = false;
      if (tuple == null) {
        delete = true;
        tuple = Arrays.asList(key.getValue());
      }
View Full Code Here

      }
      Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
      query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
     
      TupleSource ts = registerQuery(context, context.getTempTableStore(), query);
      List<?> row = ts.nextTuple();
      Object result = null;
      if (row != null) {
        result = row.get(0);
      }
      ts.closeSource();
View Full Code Here

      if (ii.ordering == null && orderBy != null) {
        SortUtility sort = new SortUtility(ts, orderBy.getOrderByItems(), Mode.SORT, bm, sessionID, projectedCols);
        tb = sort.sort();
      } else if (agg) {
        int count = 0;
        while (ts.nextTuple() != null) {
          count++;
        }
        return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), count)).iterator());
      } else if (updatable) {
        tb = bm.createTupleBuffer(projectedCols, sessionID, TupleSourceType.PROCESSOR);
View Full Code Here

        }
        return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), count)).iterator());
      } else if (updatable) {
        tb = bm.createTupleBuffer(projectedCols, sessionID, TupleSourceType.PROCESSOR);
        List<?> next = null;
        while ((next = ts.nextTuple()) != null) {
          tb.addTuple(next);
        }
      } else {
        usingQueryTupleSource = true;
        return ts;
View Full Code Here

        try {
          if (!success) {
            undoLog.setFinal(true);
            TupleSource undoTs = undoLog.createIndexedTupleSource();
            List<?> tuple = null;
            while ((tuple = undoTs.nextTuple()) != null) {
              undo(tuple);
            }
          }
        } catch (TeiidException e) {
          LogManager.logError(LogConstants.CTX_DQP, e, e.getMessage());
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.