@Override public TempTable createMatTable(String matTableName, GroupSymbol group) throws TeiidComponentException, QueryMetadataException, TeiidProcessingException { return getStoreForTable(matTableName).createMatTable(matTableName, group); }
@Override public void failedLoad(String matTableName) { getStoreForTable(matTableName).failedLoad(matTableName); }
@Override public Serializable getAddress() { return primary.getAddress(); }
if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) { Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); String matViewName = metadata.getFullName(groupID); LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(3).getExpression()).getValue()); boolean needsLoading = globalStore.getMatTableInfo(matTableName).getAndClearAsynch(); if (!needsLoading) { needsLoading = globalStore.needsLoading(matTableName, globalStore.getAddress(), true, true, invalidate); if (needsLoading) { needsLoading = globalStore.needsLoading(matTableName, globalStore.getAddress(), false, false, invalidate); } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROWS)) { final Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); Object pk = metadata.getPrimaryKey(groupID); } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) { final Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); Object pk = metadata.getPrimaryKey(groupID);
if (!info.isUpToDate()) { boolean invalidate = shouldInvalidate(context.getVdb()); load = globalStore.needsLoading(tableName, globalStore.getAddress(), true, false, info.isValid() && invalidate); if (load) { load = globalStore.needsLoading(tableName, globalStore.getAddress(), false, false, info.isValid() && invalidate); TempTable table = globalStore.getTempTable(tableName); context.accessedDataObject(group.getMetadataID()); TupleSource result = table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
GlobalTableStore globalStore = cc.getGlobalTableStore(); matTableName = RelationalPlanner.MAT_PREFIX+table.getFullName().toUpperCase(); TempMetadataID id = globalStore.getGlobalTempTableMetadataId(matTableName); MatTableInfo info = globalStore.getMatTableInfo(matTableName); valid = info.isValid(); state = info.getState().name();
TransformationException { final String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase(); MatTableInfo info = globalStore.getMatTableInfo(matTableName); if (!info.isValid()) { return CollectionTupleSource.createUpdateCountTupleSource(-1); TempTable tempTable = globalStore.getTempTable(matTableName); if (!tempTable.isUpdatable()) { throw new QueryProcessingException(QueryPlugin.Event.TEIID30232, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30232, matViewName));
@Override public TempMetadataID getGlobalTempTableMetadataId(String matTableName) { return getStoreForTable(matTableName).getGlobalTempTableMetadataId(matTableName); }
@Override public List<?> updateMatViewRow(String matTableName, List<?> tuple, boolean delete) throws TeiidComponentException { return getStoreForTable(matTableName).updateMatViewRow(matTableName, tuple, delete); }
@Override public TempMetadataID getCodeTableMetadataId(String codeTableName, String returnElementName, String keyElementName, String matTableName) throws TeiidComponentException, QueryMetadataException { return getStoreForTable(matTableName).getCodeTableMetadataId(codeTableName, returnElementName, keyElementName, matTableName); }
@Override public void loaded(String matTableName, TempTable table) { getStoreForTable(matTableName).loaded(matTableName, table); }
@Override public MatTableInfo getMatTableInfo(String matTableName) { return getStoreForTable(matTableName).getMatTableInfo(matTableName); }
@Override public boolean needsLoading(String matTableName, Serializable loadingAddress, boolean firstPass, boolean refresh, boolean invalidate) { return getStoreForTable(matTableName).needsLoading(matTableName, loadingAddress, firstPass, refresh, invalidate); }
@Override public TempTable getTempTable(String matTableName) { return getStoreForTable(matTableName).getTempTable(matTableName); }
if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) { Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); String matViewName = metadata.getFullName(groupID); LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(3).getExpression()).getValue()); boolean needsLoading = globalStore.getMatTableInfo(matTableName).getAndClearAsynch(); if (!needsLoading) { needsLoading = globalStore.needsLoading(matTableName, globalStore.getAddress(), true, true, invalidate); if (needsLoading) { needsLoading = globalStore.needsLoading(matTableName, globalStore.getAddress(), false, false, invalidate); } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROWS)) { final Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); Object pk = metadata.getPrimaryKey(groupID); } else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) { final Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue()); TempMetadataID matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID); final GlobalTableStore globalStore = getGlobalStore(context, matTableId); Object pk = metadata.getPrimaryKey(groupID);
if (!info.isUpToDate()) { boolean invalidate = shouldInvalidate(context.getVdb()); load = globalStore.needsLoading(tableName, globalStore.getAddress(), true, false, info.isValid() && invalidate); if (load) { load = globalStore.needsLoading(tableName, globalStore.getAddress(), false, false, info.isValid() && invalidate); TempTable table = globalStore.getTempTable(tableName); context.accessedDataObject(group.getMetadataID()); if (context.isParallel() && query.getCriteria() == null && query.getOrderBy() != null && table.getRowCount() > MIN_ASYNCH_SIZE) {
GlobalTableStore globalStore = cc.getGlobalTableStore(); matTableName = RelationalPlanner.MAT_PREFIX+table.getFullName().toUpperCase(); TempMetadataID id = globalStore.getGlobalTempTableMetadataId(matTableName); MatTableInfo info = globalStore.getMatTableInfo(matTableName); valid = info.isValid(); state = info.getState().name();
TransformationException { final String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase(); MatTableInfo info = globalStore.getMatTableInfo(matTableName); if (!info.isValid()) { return CollectionTupleSource.createUpdateCountTupleSource(-1); TempTable tempTable = globalStore.getTempTable(matTableName); if (!tempTable.isUpdatable()) { throw new QueryProcessingException(QueryPlugin.Event.TEIID30232, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30232, matViewName));
@Override public TempMetadataID getGlobalTempTableMetadataId(Object groupID) throws TeiidComponentException, TeiidProcessingException { Object mid = metadata.getModelID(groupID); String name = metadata.getName(mid); return getStore(name).getGlobalTempTableMetadataId(groupID); }
@Override public void updateMatViewRow(String vdbName, String vdbVersion, String schema, String viewName, List<?> tuple, boolean delete) { VDBMetaData metadata = getVdbRepository().getLiveVDB(vdbName, vdbVersion); if (metadata != null) { GlobalTableStore gts = metadata.getAttachment(GlobalTableStore.class); if (gts != null) { try { gts.updateMatViewRow((RelationalPlanner.MAT_PREFIX + schema + '.' + viewName).toUpperCase(), tuple, delete); } catch (TeiidComponentException e) { LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40013, "updateMatViewRow")); //$NON-NLS-1$ } } } }