Package org.teiid.common.buffer

Examples of org.teiid.common.buffer.TupleSource


        BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
        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) {
       
      }
      tsid.addTuple(Arrays.asList(2));
      tsid.addTuple(Arrays.asList(3));
      su.sort();
      assertEquals(Arrays.asList(2), ts.nextTuple());
    }
View Full Code Here


    private void helpTestNextBatch(int tupleBatchSize, Mode mode) throws Exception {
       
        ProjectIntoNode node = new ProjectIntoNode(2);
       
        TupleSource tupleSource =  new FakeDataTupleSource(NUM_ROWS);
        RelationalNode child = new FakeRelationalNode(1,tupleSource, tupleBatchSize);
        node.addChild(child);
        node.setIntoGroup(new GroupSymbol("myGroup")); //$NON-NLS-1$
        ElementSymbol elementSymbol_1 = new ElementSymbol("myGroup.myElement1"); //$NON-NLS-1$
        ElementSymbol elementSymbol_2 = new ElementSymbol("myGroup.myElement2"); //$NON-NLS-1$
View Full Code Here

                   
                    for (int i = 0; i < batchSize; i++) {
                        ensureValue2((List)batch.get(i), 2, ((callCount-1) * batchSize) + i + 1);
                    }
              } 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 # of rows in actual and expected
        assertEquals("Did not get expected # of rows", expectedResults.length, tsID.getRowCount()); //$NON-NLS-1$
       
        // 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

    String connectorBindingId, int nodeID, int limit)
    throws TeiidComponentException, TeiidProcessingException {         

    TempTableStore tempTableStore = context.getTempTableStore();
        if(tempTableStore != null) {
            TupleSource result = registerRequest(context, modelName, command);
            if (result != null) {
              return result;
            }
        }
        return this.processorDataManager.registerRequest(context, command, modelName, connectorBindingId, nodeID, limit);
View Full Code Here

        }
        if (command instanceof ProcedureContainer) {
          if (command instanceof StoredProcedure) {
            StoredProcedure proc = (StoredProcedure)command;
            if (CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) {
              TupleSource result = handleSystemProcedures(context, proc);
              if (result != null) {
                return result;
              }
            } else if (proc.getGroup().isGlobalTable()) {
              return handleCachedProcedure(context, proc);
            }
            return null; //it's not a stored procedure we want to handle
          }
         
          GroupSymbol group = ((ProcedureContainer)command).getGroup();
          if (!group.isTempGroupSymbol()) {
            return null;
          }
          final String groupKey = group.getNonCorrelationName().toUpperCase();
            final TempTable table = contextStore.getOrCreateTempTable(groupKey, command, bufferManager, false);
          if (command instanceof Insert) {
            Insert insert = (Insert)command;
            TupleSource ts = insert.getTupleSource();
            if (ts == null) {
              List<Object> values = new ArrayList<Object>(insert.getValues().size());
              for (Expression expr : (List<Expression>)insert.getValues()) {
                values.add(Evaluator.evaluate(expr));
          }
View Full Code Here

      String queryString = Reserved.SELECT + " * " + Reserved.FROM + ' ' + matViewName + ' ' + Reserved.WHERE + ' ' + //$NON-NLS-1$
        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

      }
    }
    int rowCount = -1;
    try {
      String fullName = metadata.getFullName(group.getMetadataID());
      TupleSource ts = null;
      CacheID cid = null;
      if (distributedCache != null) {
        cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
            context.getVdbVersion(), context.getConnectionID(), context.getUserName());
        CachedResults cr = this.distributedCache.get(cid);
View Full Code Here

        id.setCacheHint(hint);
      }
      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();
      return result;
    }
View Full Code Here

    if (indexTables == null) {
      indexTables = new LinkedHashMap<List<ElementSymbol>, TempTable>();
      indexTables.put(indexColumns, indexTable);
    }
    //TODO: ordered insert optimization
    TupleSource ts = createTupleSource(allColumns, null, null);
    indexTable.insert(ts, allColumns);
    indexTable.getTree().compact();
  }
View Full Code Here

TOP

Related Classes of org.teiid.common.buffer.TupleSource

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.