Package org.teiid.dqp.internal.process

Examples of org.teiid.dqp.internal.process.CachedResults


    hash |= (hash >>> 8);
    hash &= 0x000000ff;
    CacheID cid = new CacheID(new ParseInfo(), fullName + hash, context.getVdbName(),
        context.getVdbVersion(), context.getConnectionID(), context.getUserName());
    cid.setParameters(vals);
    CachedResults results = cache.get(cid);
    if (results != null) {
      TupleBuffer buffer = results.getResults();
      return buffer.createIndexedTupleSource();
    }
    //construct a query with a no cache hint
    //note that it's safe to use the stringified form of the parameters because
    //it's not possible to use xml/clob/blob/object
    CacheHint hint = proc.getCacheHint();
    proc.setCacheHint(null);
    Option option = new Option();
    option.setNoCache(true);
    option.addNoCacheGroup(fullName);
    proc.setOption(option);
    Determinism determinismLevel = context.resetDeterminismLevel();
    QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(proc.toString(), fullName.toUpperCase(), context);
    qp.setNonBlocking(true);
    qp.getContext().setDataObjects(null);
    BatchCollector bc = qp.createBatchCollector();
    TupleBuffer tb = bc.collectTuples();
    CachedResults cr = new CachedResults();
    cr.setResults(tb, qp.getProcessorPlan());
    cr.setHint(hint);
    if (hint != null && hint.getDeterminism() != null) {
      LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",determinismLevel, " to ", hint.getDeterminism() }); //$NON-NLS-1$ //$NON-NLS-2$
      determinismLevel = hint.getDeterminism();
    }
    cache.put(cid, determinismLevel, cr, hint != null?hint.getTtl():null);
View Full Code Here


      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);
        if (cr != null) {
          ts = cr.getResults().createIndexedTupleSource();
        }
      }
     
      List<ElementSymbol> variables = table.getColumns();
     
      if (ts == null) {
        variables = allColumns;
        //TODO: coordinate a distributed load
        //TODO: order by primary key nulls first - then have an insert ordered optimization
        String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
        QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, fullName, context);
        qp.setNonBlocking(true);
        qp.getContext().setDataObjects(null);
        if (distributedCache != null) {
          CachedResults cr = new CachedResults();
          BatchCollector bc = qp.createBatchCollector();
          TupleBuffer tb = bc.collectTuples();
          cr.setResults(tb, qp.getProcessorPlan());
          touchTable(context, fullName, true);
          this.distributedCache.put(cid, Determinism.VDB_DETERMINISTIC, cr, info.getTtl());
          ts = tb.createIndexedTupleSource();
        } else {
          ts = new BatchCollector.BatchProducerTupleSource(qp);
View Full Code Here

TOP

Related Classes of org.teiid.dqp.internal.process.CachedResults

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.