Package org.teiid.dqp.internal.process.SessionAwareCache

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID


    //collapse the hash to single byte for the key to restrict the possible results to 256
    int hash = vals.hashCode();
    hash |= (hash >>> 16);
    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();
    }
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);
        if (cr != null) {
          ts = cr.getResults().createIndexedTupleSource();
        }
View Full Code Here

  protected void processNew() throws TeiidProcessingException, TeiidComponentException {
    SessionAwareCache<CachedResults> rsCache = dqpCore.getRsCache();
       
    boolean cachable = false;
    CacheID cacheId = null;
    boolean canUseCached = (requestMsg.useResultSetCache() ||
        QueryParser.getQueryParser().parseCacheHint(requestMsg.getCommandString()) != null);
   
    if (rsCache != null) {
      if (!canUseCached) {
        LogManager.logDetail(LogConstants.CTX_DQP, requestID, "No cache directive"); //$NON-NLS-1$
      } else {
        ParseInfo pi = Request.createParseInfo(requestMsg);
        cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString());
          cachable = cacheId.setParameters(requestMsg.getParameterValues());
        if (cachable) {
          CachedResults cr = rsCache.get(cacheId);
          if (cr != null) {
            this.resultsBuffer = cr.getResults();
            this.analysisRecord = cr.getAnalysisRecord();
View Full Code Here

        Command command = null;
       
        ParseInfo info = new ParseInfo();
        // Defect 19747 - the parser needs the following connection property to decide whether to treat double-quoted strings as variable names
        info.ansiQuotedIdentifiers = isDoubleQuotedVariablesAllowed;
        CacheID id = new CacheID(workContext, info, sql);
        PreparedPlan plan = planCache.get(id);
        if(plan != null) {
            command = plan.getCommand();
        } else {
          command = QueryParser.getQueryParser().parseCommand(sql, info);
View Full Code Here

     * @throws TeiidProcessingException
     * @see org.teiid.dqp.internal.process.Request#generatePlan()
     */
    protected void generatePlan() throws TeiidComponentException, TeiidProcessingException {
      String sqlQuery = requestMsg.getCommands()[0];
      CacheID id = new CacheID(this.workContext, Request.createParseInfo(this.requestMsg), sqlQuery);
        prepPlan = prepPlanCache.get(id);
        if (prepPlan == null) {
            //if prepared plan does not exist, create one
            prepPlan = new PreparedPlan();
            LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Query does not exist in cache: ", sqlQuery}); //$NON-NLS-1$
View Full Code Here

   
    public PreparedPlan getPlan(String key) {
      if (this.globalState.planCache == null) {
        return null;
      }
      CacheID id = new CacheID(new ParseInfo(), key, getVdbName(), getVdbVersion(), getConnectionID(), getUserName());
      PreparedPlan pp = this.globalState.planCache.get(id);
      if (pp != null) {
        if (id.getSessionId() != null) {
          setDeterminismLevel(Determinism.USER_DETERMINISTIC);
        } else if (id.getUserName() != null) {
          setDeterminismLevel(Determinism.SESSION_DETERMINISTIC);
        }
          return pp;
      }
      return null;
View Full Code Here

   
    public void putPlan(String key, PreparedPlan plan, Determinism determinismLevel) {
      if (this.globalState.planCache == null) {
        return;
      }
      CacheID id = new CacheID(new ParseInfo(), key, getVdbName(), getVdbVersion(), getConnectionID(), getUserName());
      this.globalState.planCache.put(id, determinismLevel, plan, null);
    }
View Full Code Here

TOP

Related Classes of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

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.