Package org.teiid.query.tempdata.TempTableStore

Examples of org.teiid.query.tempdata.TempTableStore.MatTableInfo


      Object groupID = validateMatView(metadata, proc);
      Object matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID, metadata);
      String matViewName = metadata.getFullName(groupID);
      String matTableName = metadata.getFullName(matTableId);
      LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
      MatTableInfo info = globalStore.getMatTableInfo(matTableName);
      boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(1).getExpression()).getValue());
      if (invalidate) {
        touchTable(context, matTableName, false);
      }
      MatState oldState = info.setState(MatState.NEEDS_LOADING, invalidate?Boolean.FALSE:null, null);
      if (oldState == MatState.LOADING) {
        return CollectionTupleSource.createUpdateCountTupleSource(-1);
      }
      GroupSymbol matTable = new GroupSymbol(matTableName);
      matTable.setMetadataID(matTableId);
      int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null);
      return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
    } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
      Object groupID = validateMatView(metadata, proc);
      Object pk = metadata.getPrimaryKey(groupID);
      String matViewName = metadata.getFullName(groupID);
      if (pk == null) {
        throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_pk", matViewName)); //$NON-NLS-1$
      }
      List<?> ids = metadata.getElementIDsInKey(pk);
      if (ids.size() > 1) {
        throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_composite", matViewName)); //$NON-NLS-1$
      }
      String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
      MatTableInfo info = globalStore.getMatTableInfo(matTableName);
      if (!info.isValid()) {
        return CollectionTupleSource.createUpdateCountTupleSource(-1);
      }
      TempTable tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
      if (!tempTable.isUpdatable()) {
        throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_updatable", matViewName)); //$NON-NLS-1$
View Full Code Here


    final String tableName = group.getNonCorrelationName().toUpperCase();
    boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
    TempTable table = null;
    if (group.isGlobalTable()) {
      final TempTableStore globalStore = context.getGlobalTableStore();
      final MatTableInfo info = globalStore.getMatTableInfo(tableName);
      Long loadTime = null;
      if (this.distributedCache != null) {
        MatTableKey key = new MatTableKey();
        key.name = tableName;
        key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
       
        MatTableEntry entry = this.tables.get(key);
        boolean firstload = !info.isValid();
        if (entry != null && entry.lastUpdate > info.getUpdateTime()
            && info.getState() != MatState.LOADING) {
          //remote load
          info.setState(MatState.NEEDS_LOADING, firstload?false:entry.valid, null);
          loadTime = entry.lastUpdate;
        }
      }
      boolean load = info.shouldLoad();
      if (load) {
        if (!info.isValid()) {
          //blocking load
          loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
        } else {
          loadAsynch(context, group, tableName, globalStore, info, loadTime);
        }
View Full Code Here

              Integer cardinaltity = null;
              Boolean valid = null;
              if (table.getMaterializedTable() == null) {
                TempTableStore globalStore = context.getGlobalTableStore();
                matTableName = RelationalPlanner.MAT_PREFIX+table.getFullName().toUpperCase();
                MatTableInfo info = globalStore.getMatTableInfo(matTableName);
                valid = info.isValid();
                state = info.getState().name();
                updated = info.getUpdateTime()==-1?null:new Timestamp(info.getUpdateTime());
                TempMetadataID id = globalStore.getMetadataStore().getTempGroupID(matTableName);
                if (id != null) {
                  cardinaltity = id.getCardinality();
                }
                //ttl, pref_mem - not part of proper metadata
View Full Code Here

TOP

Related Classes of org.teiid.query.tempdata.TempTableStore.MatTableInfo

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.