teiid SVN: r2412 - in trunk/engine/src: main/java/org/teiid/common/buffer/impl and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-04 00:01:19 -0400 (Wed, 04 Aug 2010)
New Revision: 2412
Modified:
trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties
trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
Log:
TEIID-168 minor updates to caching logic TEIID-829 changing code tables to use temp tables rather than being a separate cache
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -34,7 +34,7 @@
}
- ManagedBatch createManagedBatch(TupleBatch batch) throws TeiidComponentException;
+ ManagedBatch createManagedBatch(TupleBatch batch, boolean softCache) throws TeiidComponentException;
void remove();
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -135,9 +135,9 @@
values.setDataTypes(stree.types);
}
if (children != null) {
- managedBatch = stree.keyManager.createManagedBatch(values);
+ managedBatch = stree.keyManager.createManagedBatch(values, true);
} else {
- managedBatch = stree.leafManager.createManagedBatch(values);
+ managedBatch = stree.leafManager.createManagedBatch(values, stree.preferMemory);
}
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -164,7 +164,7 @@
writeBatch.setTerminationFlag(true);
}
writeBatch.setDataTypes(types);
- BatchManager.ManagedBatch mbatch = manager.createManagedBatch(writeBatch);
+ BatchManager.ManagedBatch mbatch = manager.createManagedBatch(writeBatch, false);
this.batches.put(writeBatch.getBeginRow(), mbatch);
batchBuffer = null;
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -29,6 +29,7 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
@@ -113,9 +114,9 @@
}
@Override
- public ManagedBatch createManagedBatch(TupleBatch batch)
+ public ManagedBatch createManagedBatch(TupleBatch batch, boolean softCache)
throws TeiidComponentException {
- ManagedBatchImpl mbi = new ManagedBatchImpl(batch, this);
+ ManagedBatchImpl mbi = new ManagedBatchImpl(batch, this, softCache);
mbi.addToCache(false);
persistBatchReferences();
return mbi;
@@ -193,6 +194,7 @@
private final class ManagedBatchImpl implements ManagedBatch {
private boolean persistent;
+ private boolean softCache;
private volatile TupleBatch activeBatch;
private volatile Reference<TupleBatch> batchReference;
private int beginRow;
@@ -200,7 +202,8 @@
private long id;
private LobManager lobManager;
- public ManagedBatchImpl(TupleBatch batch, BatchManagerImpl manager) {
+ public ManagedBatchImpl(TupleBatch batch, BatchManagerImpl manager, boolean softCache) {
+ this.softCache = softCache;
id = batchAdded.incrementAndGet();
LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Add batch to BufferManager", id); //$NON-NLS-1$
this.activeBatch = batch;
@@ -331,9 +334,11 @@
}
LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, batchManager.id, id, "batch written starting at:", offset); //$NON-NLS-1$
}
- this.batchReference = new WeakReference<TupleBatch>(batch);
- } else {
- assert persistent;
+ if (softCache) {
+ this.batchReference = new SoftReference<TupleBatch>(batch);
+ } else {
+ this.batchReference = new WeakReference<TupleBatch>(batch);
+ }
}
} catch (IOException e) {
throw new TeiidComponentException(e);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -146,7 +146,7 @@
// Defect 13751: Clone the plan in its current state (i.e. before processing) so that it can be used for later queries
prepPlan.setPlan(processPlan.clone());
prepPlan.setAnalysisRecord(analysisRecord);
- this.prepPlanCache.put(id, this.context.isSessionFunctionEvaluated(), this.context.isUserFunctionEvaluated(), prepPlan);
+ this.prepPlanCache.put(id, this.context.getDeterminismLevel(), prepPlan);
}
} else {
LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Query exist in cache: ", sqlQuery }); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -59,6 +59,7 @@
import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.execution.QueryExecPlugin;
+import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.QueryProcessor;
import org.teiid.query.sql.lang.Command;
@@ -362,13 +363,15 @@
doneProducingBatches();
}
if (doneProducingBatches && cid != null) {
- boolean sessionScope = processor.getContext().isSessionFunctionEvaluated();
- boolean userScope = processor.getContext().isUserFunctionEvaluated();
+ int determinismLevel = processor.getContext().getDeterminismLevel();
CachedResults cr = new CachedResults();
cr.setCommand(originalCommand);
cr.setAnalysisRecord(analysisRecord);
cr.setResults(resultsBuffer);
- dqpCore.getRsCache().put(cid, sessionScope, userScope, cr);
+ if (determinismLevel > FunctionMethod.SESSION_DETERMINISTIC) {
+ LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
+ }
+ dqpCore.getRsCache().put(cid, determinismLevel, cr);
}
add = sendResultsIfNeeded(batch);
if (!added) {
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -239,16 +239,11 @@
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0002, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0002, getName()));
}
- if (getDeterministic() == FunctionMethod.USER_DETERMINISTIC && values.length > 0 && values[0] instanceof CommandContext) {
+ if (getDeterministic() >= FunctionMethod.USER_DETERMINISTIC && values.length > 0 && values[0] instanceof CommandContext) {
CommandContext cc = (CommandContext)values[0];
- cc.setUserFunctionEvaluated(true);
+ cc.setDeterminismLevel(getDeterministic());
}
- if (getDeterministic() >= FunctionMethod.SESSION_DETERMINISTIC && values.length > 0 && values[0] instanceof CommandContext) {
- CommandContext cc = (CommandContext)values[0];
- cc.setSessionFunctionEvaluated(true);
- }
-
// Invoke the method and return the result
try {
if (method.isVarArgs()) {
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -86,10 +86,8 @@
private QueryProcessor.ProcessorFactory queryProcessorFactory;
- private boolean sessionFunctionEvaluated;
+ private int determinismLevel;
- private boolean userFunctionEvaluated;
-
private Set<String> groups;
private long timeSliceEnd = Long.MAX_VALUE;
@@ -140,22 +138,14 @@
public CommandContext() {
}
- public boolean isSessionFunctionEvaluated() {
- return globalState.sessionFunctionEvaluated;
+ public int getDeterminismLevel() {
+ return globalState.determinismLevel;
}
- public void setSessionFunctionEvaluated(boolean sessionFunctionEvaluated) {
- globalState.sessionFunctionEvaluated = sessionFunctionEvaluated;
- }
+ public void setDeterminismLevel(int level) {
+ globalState.determinismLevel = Math.max(globalState.determinismLevel, level);
+ }
- public boolean isUserFunctionEvaluated() {
- return globalState.userFunctionEvaluated;
- }
-
- public void setUserFunctionEvaluated(boolean userFunctionEvaluated) {
- globalState.userFunctionEvaluated = userFunctionEvaluated;
- }
-
/**
* @return
*/
Modified: trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties 2010-08-04 04:01:19 UTC (rev 2412)
@@ -514,7 +514,6 @@
TransformationMetadata.Invalid_type=Invalid type: {0}.
TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine fullname for element
-CachedRequestWorkItem.not_available=Cache result is no longer available.
CachedFinder.no_connector_found=No connector with jndi-name {0} found for Model {1} with source name {2}
failed_to_get_connection= Failed to get connection for translator {0}
failed_to_close_connection=Failed to close the connection for translator {0}
@@ -522,5 +521,7 @@
datasource_not_found=Data Source {0} not accessible.
failed_to_bind_translator=Failed to bind the translator {0} on the jndi tree
failed_to_unbind_translator=Failed to un-bind the translator {0} from the jndi tree.
+
+RequestWorkItem.cache_nondeterministic=Caching command '{0}'' at a session level, but less deterministic functions were evaluated.
not_found_cache=Results not found in cache
failed_to_put_in_cache=Failed to put results in the cache
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -45,7 +45,7 @@
}
@Override
- public ManagedBatch createManagedBatch(final TupleBatch batch)
+ public ManagedBatch createManagedBatch(final TupleBatch batch, boolean softCache)
throws TeiidComponentException {
return new ManagedBatch() {
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-04 04:00:09 UTC (rev 2411)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-04 04:01:19 UTC (rev 2412)
@@ -31,6 +31,7 @@
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.parser.ParseInfo;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.relational.ProjectNode;
@@ -61,7 +62,7 @@
//No PreparedPlan at the begining
assertNull(cache.get(id));
//create one
- cache.put(id, true, false, new PreparedPlan());
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, new PreparedPlan());
//should have one now
assertNotNull("Unable to get prepared plan from cache", cache.get(id)); //$NON-NLS-1$
}
@@ -148,7 +149,7 @@
CacheID id = new CacheID(session, pi, dummy.toString());
PreparedPlan pPlan = new PreparedPlan();
- cache.put(id, true, false, pPlan);
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, pPlan);
pPlan.setCommand(dummy);
pPlan.setPlan(new RelationalPlan(new ProjectNode(i)));
AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
14 years, 5 months
teiid SVN: r2411 - in trunk: client/src/main/java/org/teiid/adminapi and 19 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-04 00:00:09 -0400 (Wed, 04 Aug 2010)
New Revision: 2411
Removed:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
trunk/documentation/caching-guide/
trunk/documentation/caching-guide/pom.xml
trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
Log:
TEIID-168 minor updates to caching logic TEIID-829 changing code tables to use temp tables rather than being a separate cache
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-04 04:00:09 UTC (rev 2411)
@@ -78,12 +78,6 @@
<property name="lobChunkSizeInKB">100</property>
<!-- The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250) -->
<property name="preparedPlanCacheMaxCount">250</property>
- <!-- Maximum number of cached lookup tables. Note: this is a memory based cache and should be set to a value of at least 10 to accomidate system usage. (default 200) -->
- <property name="codeTablesMaxCount">200</property>
- <!-- Maximum number of records in a single lookup table (default 10000) -->
- <property name="codeTablesMaxRowsPerTable">10000</property>
- <!-- Maximum number of records in all lookup tables (default 200000) -->
- <property name="codeTablesMaxRows">200000</property>
<!-- Max Entries allowed for ResultSet Cache -->
<property name="resultSetCacheMaxEntries">1024</property>
<!-- Enable Resultset Caching -->
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,7 +29,7 @@
public interface Admin {
- public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
+ public enum Cache {PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
/**
* Assign a {@link Translator} and Data source to a {@link VDB}'s Model
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-04 04:00:09 UTC (rev 2411)
@@ -267,10 +267,6 @@
displayName="Max Rows Fetch Size"
description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)"
required="false" readOnly="false" />
- <c:simple-property name="codeTablesMaxRows"
- displayName="Code Tables Max Rows"
- description="Maximum number of records in all lookup tables (default 200000)"
- required="false" readOnly="false" />
<c:simple-property name="processName" displayName="Process Name"
description="Name that uniquely identifies this process" required="false"
readOnly="false" />
@@ -289,18 +285,10 @@
displayName="Lob Chunk Size In KB"
description="The max lob chunk size in KB transferred each time when processing blobs, clobs(100KB default)"
required="false" readOnly="false" />
- <c:simple-property name="codeTablesMaxCount"
- displayName="Code Tables Max Count"
- description="The max lob chunk size in KB transferred each time when processing blobs, clobs(100KB default)"
- required="false" readOnly="false" />
<c:simple-property name="resultSetCacheEnabled"
displayName="Result Set Cache Enabled"
description="Denotes whether or not result set caching is enabled. (default true)"
required="false" readOnly="false" type="boolean" />
- <c:simple-property name="codeTablesMaxRowsPerTable"
- displayName="Code Tables Max Rows Per Table"
- description="Maximum number of records in all lookup tables (default 200000)"
- required="false" readOnly="false" />
<c:simple-property name="activeSessionsCount"
displayName="Active Session Count" description="Count of active sessions"
required="false" readOnly="false" />
Property changes on: trunk/documentation/caching-guide
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/documentation/caching-guide/pom.xml
===================================================================
--- trunk/documentation/caching-guide/pom.xml 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/documentation/caching-guide/pom.xml 2010-08-04 04:00:09 UTC (rev 2411)
@@ -46,7 +46,7 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>caching_guide.pdf</finalName>
+ <finalName>teiid_caching_guide.pdf</finalName>
</format>
<!-- <format>
<formatName>html_single</formatName>
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -56,6 +56,7 @@
protected int keyLength;
protected String[] types;
protected String[] keytypes;
+ protected boolean preferMemory;
protected ReentrantLock updateLock = new ReentrantLock();
@@ -351,4 +352,8 @@
return keyLength;
}
+ public void setPreferMemory(boolean preferMemory) {
+ this.preferMemory = preferMemory;
+ }
+
}
\ No newline at end of file
Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -1,291 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.util.HashCodeUtil;
-import org.teiid.dqp.DQPPlugin;
-import org.teiid.logging.LogManager;
-import org.teiid.query.util.CommandContext;
-import org.teiid.vdb.runtime.VDBKey;
-
-
-/**
- * Code table cache. Heavily synchronized in-memory cache of code tables. There is no purging policy for this cache. Once the limits have been reached exceptions will occur.
- */
-class CodeTableCache {
-
- private static class CodeTable {
- Map<Object, Object> codeMap;
- Set<Object> waitingRequests = new HashSet<Object>();
- }
-
- // Max number of code tables that can be loaded
- private int maxCodeTables;
-
- // Max number of code records that can be loaded
- private int maxCodeRecords;
-
- private int maxCodeTableRecords;
-
- private int rowCount;
-
- // Cache itself - key is CacheKey, value is Map (which is the key value -> return value for the code table)
- private Map<CacheKey, CodeTable> codeTableCache = new HashMap<CacheKey, CodeTable>();
-
- public enum CacheState {
- CACHE_EXISTS,
- CACHE_LOADING,
- CACHE_NOT_EXIST,
- CACHE_OVERLOAD
- }
-
- /**
- * Construct a code table cache
- */
- public CodeTableCache(int maxCodeTables, int maxCodeRecords, int maxCodeTableRecords) {
- this.maxCodeRecords = maxCodeRecords;
- this.maxCodeTables = maxCodeTables;
- this.maxCodeTableRecords = maxCodeTableRecords;
- }
-
- /**
- * Return the state of cache.
- * @param codeTable code table name
- * @param returnElement return element name
- * @param keyElement key element name
- * @param context context in processing
- * @param keyValye key value cached in data map
- * @return int of cache states
- */
- public synchronized CacheState cacheExists(String codeTable, String returnElement, String keyElement, CommandContext context) {
- // Check whether CacheKey exist in cacheKeyDone:
- // If yes, return CACHE_EXISTS
- // If no, does it exist in loadingCaches?
- // If yes, add to additional contexts and return CACHE_LOADING
- // If no, can we add another cache?
- // If yes, add to loadingCaches as primary context, return CACHE_NOT_EXIST
- // If no, return CACHE_OVERLOAD
-
- // Create a CacheKey
- CacheKey cacheKey = new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
- CodeTable table = this.codeTableCache.get(cacheKey);
- if (table == null) {
- if(codeTableCache.size() >= maxCodeTables) {
- // In this case we already have some number of existing + loading caches
- // that are >= the max number we are allowed to have. Thus, we cannot load
- // another cache.
- return CacheState.CACHE_OVERLOAD;
- }
- table = new CodeTable();
- table.waitingRequests.add(context.getProcessorID());
- this.codeTableCache.put(cacheKey, table);
- return CacheState.CACHE_NOT_EXIST;
- }
- if (table.waitingRequests == null) { // CacheKey exists in codeTableCache
- return CacheState.CACHE_EXISTS;
- }
- // Add context to additional contexts
- table.waitingRequests.add(context.getProcessorID());
- return CacheState.CACHE_LOADING;
- }
-
- /**
- * Set request ID for request key to cache key mapping.
- * <Map: requestKey(requestID, nodeID) --> cacheKey(codeTable, returnElement, keyElement) >
- * @param codeTable Code table name
- * @param returnElement Return element name
- * @param keyElement Key element name
- * @param requestID Request ID
- * @param nodeID Plan Node ID
- */
- public CacheKey createCacheRequest(String codeTable, String returnElement, String keyElement, CommandContext context) {
- return new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
- }
-
- /**
- * Load all rows from the tuple source. Each row contains: keyElement and returnElement.
- * @param requestID Part of RequestKey
- * @param nodeID Part of RequestKey
- * @param results QueryResults of <List<List<keyValue, returnValue>>
- * @throws TeiidProcessingException
- */
- public synchronized void loadTable(CacheKey cacheKey, List<List> records) throws TeiidProcessingException {
- // Lookup the existing data
- // Map of data: keyValue --> returnValue;
- CodeTable table = codeTableCache.get(cacheKey);
- if(table.codeMap == null) {
- table.codeMap = new HashMap<Object, Object>();
- }
-
- // Determine whether the results should be added to code table cache
- // Depends on size of results and available memory and system parameters
- int potentialSize = table.codeMap.size() + records.size();
- if (potentialSize > maxCodeTableRecords) {
- throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTables")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- if (potentialSize + rowCount > maxCodeRecords) {
- throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTableRecords")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- // Add data: <List<List<keyValue, returnValue>> from results to the code table cache
- for (List<Object> record : records) {
- // each record or row
- Object keyValue = record.get(0);
- Object returnValue = record.get(1);
- Object existing = table.codeMap.put(keyValue, returnValue);
- if (existing != null) {
- throw new TeiidProcessingException(DQPPlugin.Util.getString("CodeTableCache.duplicate_key", cacheKey.getCodeTable(), cacheKey.getKeyElement(), keyValue)); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Look up return value in code table cache given the key value.
- * @param codeTable Code Table name
- * @param returnElement Return element name
- * @param keyElement Key element name
- * @param keyValue Input key value
- * @return Object of return value in code table cache
- */
- public synchronized Object lookupValue(String codeTable, String returnElement, String keyElement, Object keyValue, CommandContext context) throws TeiidComponentException {
- // Create CacheKey
- CacheKey cacheKey = new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
-
- // Find the corresponding data map in cache for the cache key
- CodeTable table = codeTableCache.get(cacheKey);
- if(table == null || table.codeMap == null) {
- throw new TeiidComponentException(DQPPlugin.Util.getString("CodeTableCache.No_code_table", cacheKey.codeTable,cacheKey.keyElement,cacheKey.returnElement)); //$NON-NLS-1$
- }
- return table.codeMap.get(keyValue);
- }
-
- /**
- * Notifies the CodeTableCache that this code is done. If the table had an error, it removes any temporary results.
- * @return the set of waiting requests
- */
- public synchronized Set<Object> markCacheDone(CacheKey cacheKey, boolean success) {
- if (!success) {
- // Remove any results already cached
- CodeTable table = codeTableCache.remove(cacheKey);
- if (table != null) {
- return table.waitingRequests;
- }
- return null;
- }
- CodeTable table = codeTableCache.get(cacheKey);
- if (table == null || table.codeMap == null) {
- return null; //can only happen if cache was cleared between load and now
- }
- rowCount += table.codeMap.size();
- Set<Object> waiting = table.waitingRequests;
- table.waitingRequests = null;
- return waiting;
- }
-
- public synchronized void clearAll() {
- // Look through the loaded caches and clear them - this is safe because
- // these are done. There is a window where cacheExists() can be called and
- // return CACHE_EXISTS but then clearAll() could be called before lookValue()
- // is called. We accept this as a possibility such that this is a risk when
- // clearing the cache - we need to throw an exception in this case to ensure the
- // query fails (rather than return the wrong result).
-
- // Walk through every key in the done cache and remove it
- int removedTables = 0;
- int removedRecords = this.rowCount;
- for (Iterator<CodeTable> iter = codeTableCache.values().iterator(); iter.hasNext();) {
- CodeTable table = iter.next();
- if (table.waitingRequests == null) {
- removedTables++;
- iter.remove();
- }
- }
-
- // Clear the cacheKeyDone
- this.rowCount = 0;
- // Log status
- LogManager.logInfo(org.teiid.logging.LogConstants.CTX_DQP, DQPPlugin.Util.getString("CodeTableCache.Cleared_code_tables", removedTables, removedRecords)); //$NON-NLS-1$
- }
-
- /**
- * Cache Key consists: codeTable, returnElement and keyElement.
- */
- static class CacheKey {
- private String codeTable;
- private String returnElement;
- private String keyElement;
- private VDBKey vdbKey;
-
- private int hashCode;
-
- public CacheKey(String codeTable, String returnElement, String keyElement, String vdbName, int vdbVersion) {
- this.codeTable = codeTable;
- this.returnElement = returnElement;
- this.keyElement = keyElement;
- this.vdbKey = new VDBKey(vdbName, vdbVersion);
-
- // Compute hash code and cache it
- hashCode = HashCodeUtil.hashCode(codeTable.toUpperCase().hashCode(), returnElement.toUpperCase(),
- keyElement.toUpperCase(), vdbKey);
- }
-
- public String getCodeTable() {
- return this.codeTable;
- }
-
- public String getKeyElement() {
- return this.keyElement;
- }
-
- public int hashCode() {
- return hashCode;
- }
-
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
- if(obj instanceof CacheKey) {
- CacheKey other = (CacheKey) obj;
-
- return (other.hashCode() == hashCode() &&
- this.codeTable.equalsIgnoreCase(other.codeTable) &&
- this.returnElement.equalsIgnoreCase(other.returnElement) &&
- this.keyElement.equalsIgnoreCase(other.keyElement) &&
- this.vdbKey.equals(other.vdbKey));
- }
- return false;
- }
- }
-
-}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,9 +29,6 @@
public class DQPConfiguration{
//Constants
- static final int DEFAULT_MAX_CODE_TABLE_RECORDS = 10000;
- static final int DEFAULT_MAX_CODE_TABLES = 200;
- static final int DEFAULT_MAX_CODE_RECORDS = 200000;
static final int DEFAULT_FETCH_SIZE = RequestMessage.DEFAULT_FETCH_SIZE * 10;
static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
static final int DEFAULT_MAX_RESULTSET_CACHE_ENTRIES = 1024;
@@ -46,9 +43,6 @@
private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
private int lobChunkSizeInKB = 100;
private int preparedPlanCacheMaxCount = SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL;
- private int codeTablesMaxCount = DEFAULT_MAX_CODE_TABLES;
- private int codeTablesMaxRowsPerTable = DEFAULT_MAX_CODE_TABLE_RECORDS;
- private int codeTablesMaxRows = DEFAULT_MAX_CODE_RECORDS;
private boolean resultSetCacheEnabled = true;
private int maxResultSetCacheEntries = DQPConfiguration.DEFAULT_MAX_RESULTSET_CACHE_ENTRIES;
private boolean useEntitlements = false;
@@ -111,33 +105,6 @@
this.preparedPlanCacheMaxCount = preparedPlanCacheMaxCount;
}
- @ManagementProperty(description="Maximum number of cached lookup tables. Note: this is a memory based cache. (default 200)")
- public int getCodeTablesMaxCount() {
- return this.codeTablesMaxCount;
- }
-
- public void setCodeTablesMaxCount(int codeTablesMaxCount) {
- this.codeTablesMaxCount = codeTablesMaxCount;
- }
-
- @ManagementProperty(description="Maximum number of records in a single lookup table (default 10000)")
- public int getCodeTablesMaxRowsPerTable() {
- return codeTablesMaxRowsPerTable;
- }
-
- public void setCodeTablesMaxRowsPerTable(int codeTablesMaxRowsPerTable) {
- this.codeTablesMaxRowsPerTable = codeTablesMaxRowsPerTable;
- }
-
- @ManagementProperty(description="Maximum number of records in all lookup tables (default 200000)")
- public int getCodeTablesMaxRows() {
- return this.codeTablesMaxRows;
- }
-
- public void setCodeTablesMaxRows(int codeTablesMaxRows) {
- this.codeTablesMaxRows = codeTablesMaxRows;
- }
-
@ManagementProperty(description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)")
public int getResultSetCacheMaxEntries() {
return this.maxResultSetCacheEntries;
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -176,11 +176,6 @@
private ThreadReuseExecutor processWorkerPool;
- // System properties for Code Table
- private int maxCodeTableRecords = DQPConfiguration.DEFAULT_MAX_CODE_TABLE_RECORDS;
- private int maxCodeTables = DQPConfiguration.DEFAULT_MAX_CODE_TABLES;
- private int maxCodeRecords = DQPConfiguration.DEFAULT_MAX_CODE_RECORDS;
-
private int maxFetchSize = DQPConfiguration.DEFAULT_FETCH_SIZE;
private int queryThreshold = DQPConfiguration.DEFAULT_QUERY_THRESHOLD;
@@ -541,11 +536,6 @@
this.prepPlanCache.clearAll();
}
- private void clearCodeTableCache(){
- LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPCore.Clearing_code_table_cache")); //$NON-NLS-1$
- this.dataTierMgr.clearCodeTables();
- }
-
private void clearResultSetCache() {
//clear cache in server
if(rsCache != null){
@@ -556,7 +546,6 @@
public Collection<String> getCacheTypes(){
ArrayList<String> caches = new ArrayList<String>();
- caches.add(Admin.Cache.CODE_TABLE_CACHE.toString());
caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
return caches;
@@ -565,9 +554,6 @@
public void clearCache(String cacheType) {
Admin.Cache cache = Admin.Cache.valueOf(cacheType);
switch (cache) {
- case CODE_TABLE_CACHE:
- clearCodeTableCache();
- break;
case PREPARED_PLAN_CACHE:
clearPlanCache();
break;
@@ -636,9 +622,6 @@
public void start(DQPConfiguration config) {
this.processorTimeslice = config.getTimeSliceInMilli();
this.maxFetchSize = config.getMaxRowsFetchSize();
- this.maxCodeTableRecords = config.getCodeTablesMaxRowsPerTable();
- this.maxCodeTables = config.getCodeTablesMaxCount();
- this.maxCodeRecords = config.getCodeTablesMaxRows();
this.useEntitlements = config.useEntitlements();
this.queryThreshold = config.getQueryThresholdInSecs();
this.maxSourceRows = config.getMaxSourceRows();
@@ -663,10 +646,7 @@
dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
this.connectorManagerRepository,
- this.bufferService,
- this.maxCodeTables,
- this.maxCodeRecords,
- this.maxCodeTableRecords), this.bufferManager);
+ this.bufferService), this.bufferManager);
}
public void setBufferService(BufferService service) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -37,7 +36,6 @@
import org.teiid.client.RequestMessage;
import org.teiid.client.util.ResultsFuture;
import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.CoreConstants;
import org.teiid.core.TeiidComponentException;
@@ -53,11 +51,9 @@
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.ConnectorWork;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheKey;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.RequestID;
import org.teiid.dqp.service.BufferService;
-import org.teiid.language.SQLConstants.Reserved;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.Column;
import org.teiid.metadata.Datatype;
@@ -71,7 +67,6 @@
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.processor.CollectionTupleSource;
import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.processor.QueryProcessor;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.StoredProcedure;
@@ -112,14 +107,10 @@
private BufferService bufferService;
private ConnectorManagerRepository connectorManagerRepository;
- // Processor state
- private CodeTableCache codeTableCache;
-
- public DataTierManagerImpl(DQPCore requestMgr, ConnectorManagerRepository connectorRepo, BufferService bufferService, int maxCodeTables, int maxCodeRecords, int maxCodeTableRecords) {
+ public DataTierManagerImpl(DQPCore requestMgr, ConnectorManagerRepository connectorRepo, BufferService bufferService) {
this.requestMgr = requestMgr;
this.connectorManagerRepository = connectorRepo;
this.bufferService = bufferService;
- this.codeTableCache = new CodeTableCache(maxCodeTables, maxCodeRecords, maxCodeTableRecords);
}
private ConnectorManager getCM(String connectorName) {
@@ -353,22 +344,6 @@
return aqr;
}
- /**
- * Notify each waiting request that the code table data is now available.
- * @param requests
- * @since 4.2
- */
- private void notifyWaitingCodeTableRequests(Collection requests) {
- if (requests != null) {
- for (Iterator reqIter = requests.iterator(); reqIter.hasNext();) {
- RequestWorkItem workItem = requestMgr.safeGetWorkItem(reqIter.next());
- if (workItem != null) {
- workItem.moreWork();
- }
- }
- }
- }
-
public Object lookupCodeValue(
CommandContext context,
String codeTableName,
@@ -376,52 +351,9 @@
String keyElementName,
Object keyValue)
throws BlockedException, TeiidComponentException, TeiidProcessingException {
-
- switch (this.codeTableCache.cacheExists(codeTableName, returnElementName, keyElementName, context)) {
- case CACHE_NOT_EXIST:
- registerCodeTableRequest(context, codeTableName, returnElementName, keyElementName);
- case CACHE_EXISTS:
- return this.codeTableCache.lookupValue(codeTableName, returnElementName, keyElementName, keyValue, context);
- case CACHE_OVERLOAD:
- throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTables")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- default:
- throw BlockedException.INSTANCE;
- }
+ throw new UnsupportedOperationException();
}
- void registerCodeTableRequest(
- final CommandContext context,
- final String codeTableName,
- String returnElementName,
- String keyElementName)
- throws TeiidComponentException, TeiidProcessingException {
-
- String query = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
-
- final CacheKey codeRequestId = this.codeTableCache.createCacheRequest(codeTableName, returnElementName, keyElementName, context);
-
- boolean success = false;
- try {
- QueryProcessor processor = context.getQueryProcessorFactory().createQueryProcessor(query, codeTableName.toUpperCase(), context);
- processor.setNonBlocking(true); //process lookup as fully blocking
- while (true) {
- TupleBatch batch = processor.nextBatch();
- codeTableCache.loadTable(codeRequestId, batch.getTuples());
- if (batch.getTerminationFlag()) {
- break;
- }
- }
- success = true;
- } finally {
- Collection requests = codeTableCache.markCacheDone(codeRequestId, success);
- notifyWaitingCodeTableRequests(requests);
- }
- }
-
- public void clearCodeTables() {
- this.codeTableCache.clearAll();
- }
-
<T> ResultsFuture<T> addWork(Callable<T> callable, int priority) {
return requestMgr.addWork(callable, priority);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -36,6 +36,7 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.parser.ParseInfo;
import org.teiid.vdb.runtime.VDBKey;
@@ -115,12 +116,12 @@
/**
* Create PreparedPlan for the given clientConn and SQl query
*/
- public void put(CacheID id, boolean sessionSpecific, boolean userSpecific, T t){
+ public void put(CacheID id, int determinismLevel, T t){
if (!id.cachable) {
return;
}
- if (sessionSpecific) {
+ if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
id.setSessionId(id.originalSessionId);
this.localCache.put(id, t);
}
@@ -130,7 +131,7 @@
id.setSessionId(null);
- if (userSpecific) {
+ if (determinismLevel == FunctionMethod.USER_DETERMINISTIC) {
id.setUserName(id.originalUserName);
}
else {
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -250,7 +250,7 @@
}
if(groupID instanceof TempMetadataID && !(actualMetadata instanceof TempMetadataAdapter)) {
- return null;
+ return ((TempMetadataID)groupID).getQueryNode();
}
return this.actualMetadata.getVirtualPlan(groupID);
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -28,6 +28,7 @@
import java.util.List;
import org.teiid.core.util.LRUCache;
+import org.teiid.query.mapping.relational.QueryNode;
/**
@@ -53,6 +54,7 @@
private LRUCache<Object, Object> localCache;
private boolean scalarGroup;
private List<TempMetadataID> primaryKey;
+ private QueryNode queryNode;
/**
* Constructor for group form of metadata ID.
@@ -268,5 +270,13 @@
public void setPosition(int position) {
this.position = position;
}
+
+ public QueryNode getQueryNode() {
+ return queryNode;
+ }
+
+ public void setQueryNode(QueryNode queryNode) {
+ this.queryNode = queryNode;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -170,7 +170,7 @@
if (columnIndex == -1) {
throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
- Table table = this.store.findGroup(elementName.substring(0, columnIndex));
+ Table table = this.store.findGroup(elementName.substring(0, columnIndex).toLowerCase());
String shortElementName = elementName.substring(columnIndex + 1);
for (Column column : (List<Column>)getElementIDsInGroupID(table)) {
if (column.getName().equalsIgnoreCase(shortElementName)) {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -96,6 +96,7 @@
import org.teiid.query.sql.symbol.AllSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.symbol.Reference;
+import org.teiid.query.sql.symbol.SelectSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.util.SymbolMap;
import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
@@ -912,36 +913,7 @@
boolean isGlobal = matMetadataId == null;
if (isGlobal) {
matTableName = MAT_PREFIX + groupName;
- TempMetadataStore store = context.getGlobalTableStore().getMetadataStore();
- TempMetadataID id = store.getTempGroupID(matTableName);
- //define the table preserving the primary key
- if (id == null) {
- synchronized (store) {
- id = store.getTempGroupID(matTableName);
- if (id == null) {
- //this is really just temporary and will be replaced by the real table
- id = store.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(virtualGroup, metadata), false, true);
-
- id.setCardinality(metadata.getCardinality(metadataID));
-
- Object pk = metadata.getPrimaryKey(virtualGroup.getMetadataID());
- //primary key
- if (pk != null) {
- List cols = metadata.getElementIDsInKey(pk);
- ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
- for (Object coldId : cols) {
- int pos = metadata.getPosition(coldId) - 1;
- primaryKey.add(id.getElements().get(pos));
- }
- id.setPrimaryKey(primaryKey);
- }
- //version column?
-
- //add timestamp?
- }
- }
- }
- matMetadataId = id;
+ matMetadataId = getGlobalTempTableMetadataId(virtualGroup, matTableName);
} else {
matTableName = metadata.getFullName(matMetadataId);
}
@@ -953,12 +925,7 @@
recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.materialized_table_not_used"); //$NON-NLS-1$
}else{
qnode = new QueryNode(groupName, null);
- Query query = new Query();
- query.setSelect(new Select(Arrays.asList(new AllSymbol())));
- GroupSymbol gs = new GroupSymbol(matTableName);
- gs.setGlobalTable(isGlobal);
- gs.setMetadataID(matMetadataId);
- query.setFrom(new From(Arrays.asList(new UnaryFromClause(gs))));
+ Query query = createMatViewQuery(matMetadataId, matTableName, Arrays.asList(new AllSymbol()), isGlobal);
qnode.setCommand(query);
cacheString = "matview"; //$NON-NLS-1$
recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.Query_was_redirected_to_Mat_table"); //$NON-NLS-1$
@@ -971,7 +938,51 @@
Command result = getCommand(virtualGroup, qnode, cacheString, metadata);
return QueryRewriter.rewrite(result, metadata, context);
}
+
+ public static Query createMatViewQuery(Object matMetadataId, String matTableName, List<? extends SelectSymbol> select, boolean isGlobal) {
+ Query query = new Query();
+ query.setSelect(new Select(select));
+ GroupSymbol gs = new GroupSymbol(matTableName);
+ gs.setGlobalTable(isGlobal);
+ gs.setMetadataID(matMetadataId);
+ query.setFrom(new From(Arrays.asList(new UnaryFromClause(gs))));
+ return query;
+ }
+ private Object getGlobalTempTableMetadataId(GroupSymbol table, String matTableName)
+ throws QueryMetadataException, TeiidComponentException {
+ TempMetadataStore store = context.getGlobalTableStore().getMetadataStore();
+ TempMetadataID id = store.getTempGroupID(matTableName);
+ //define the table preserving the primary key
+ if (id == null) {
+ synchronized (store) {
+ id = store.getTempGroupID(matTableName);
+ if (id == null) {
+ //this is really just temporary and will be replaced by the real table
+ id = store.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(table, metadata), false, true);
+ id.setQueryNode(metadata.getVirtualPlan(table.getMetadataID()));
+ id.setCardinality(metadata.getCardinality(table.getMetadataID()));
+
+ Object pk = metadata.getPrimaryKey(table.getMetadataID());
+ //primary key
+ if (pk != null) {
+ List cols = metadata.getElementIDsInKey(pk);
+ ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
+ for (Object coldId : cols) {
+ int pos = metadata.getPosition(coldId) - 1;
+ primaryKey.add(id.getElements().get(pos));
+ }
+ id.setPrimaryKey(primaryKey);
+ }
+ //version column?
+
+ //add timestamp?
+ }
+ }
+ }
+ return id;
+ }
+
private Command getCommand(GroupSymbol virtualGroup, QueryNode qnode,
String cacheString, QueryMetadataInterface qmi) throws TeiidComponentException,
QueryMetadataException, QueryResolverException,
Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -47,6 +47,5 @@
String keyElementName,
Object keyValue) throws BlockedException,
TeiidComponentException, TeiidProcessingException;
-
- void clearCodeTables();
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -24,15 +24,14 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
/**
@@ -75,7 +74,7 @@
private Into into;
/** xml projected symbols */
- private List selectList;
+ private List<SingleElementSymbol> selectList;
// =========================================================================
// C O N S T R U C T O R S
@@ -291,7 +290,7 @@
* single column.
* @return Ordered list of SingleElementSymbol
*/
- public List getProjectedSymbols() {
+ public List<SingleElementSymbol> getProjectedSymbols() {
if (!getIsXML()) {
if(getSelect() != null) {
if(getInto() != null){
@@ -300,10 +299,10 @@
}
return getSelect().getProjectedSymbols();
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
if(selectList == null){
- selectList = new ArrayList(1);
+ selectList = new ArrayList<SingleElementSymbol>(1);
ElementSymbol xmlElement = new ElementSymbol("xml"); //$NON-NLS-1$
xmlElement.setType(DataTypeManager.DefaultDataClasses.XML);
selectList.add(xmlElement);
@@ -343,7 +342,7 @@
}
if(getOrderBy() != null) {
- copy.setOrderBy( (OrderBy) getOrderBy().clone());
+ copy.setOrderBy(getOrderBy().clone());
}
if(getLimit() != null) {
@@ -354,11 +353,7 @@
copy.setIsXML(getIsXML());
if(selectList != null){
- copy.selectList = new ArrayList();
- Iterator iter = selectList.iterator();
- while(iter.hasNext()) {
- copy.selectList.add(((SelectSymbol)iter.next()).clone());
- }
+ copy.selectList = LanguageObject.Util.deepClone(selectList, SingleElementSymbol.class);
}
if (into != null) {
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -216,6 +216,7 @@
bm.releaseBuffers(reserved);
try {
if (!success) {
+ undoLog.setFinal(true);
TupleSource undoTs = undoLog.createIndexedTupleSource();
List<?> tuple = null;
while ((tuple = undoTs.nextTuple()) != null) {
@@ -530,5 +531,9 @@
throw new AssertionError("Update failed"); //$NON-NLS-1$
}
}
+
+ void setPreferMemory(boolean preferMemory) {
+ this.tree.setPreferMemory(preferMemory);
+ }
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -34,9 +34,13 @@
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.SQLConstants.Reserved;
import org.teiid.query.eval.Evaluator;
import org.teiid.query.execution.QueryExecPlugin;
+import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.CollectionTupleSource;
@@ -44,6 +48,7 @@
import org.teiid.query.processor.QueryProcessor;
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.Create;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.Delete;
@@ -53,6 +58,7 @@
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.Update;
import org.teiid.query.sql.navigator.PostOrderNavigator;
+import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -61,15 +67,13 @@
import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
import org.teiid.query.util.CommandContext;
-
/**
* This proxy ProcessorDataManager is used to handle temporary tables.
*/
public class TempTableDataManager implements ProcessorDataManager {
-
-
- private ProcessorDataManager processorDataManager;
+ private static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
+ private ProcessorDataManager processorDataManager;
private BufferManager bufferManager;
/**
@@ -104,7 +108,7 @@
TempTableStore contextStore = context.getTempTableStore();
if (command instanceof Query) {
Query query = (Query)command;
- return registerQuery(context, command, contextStore, query);
+ return registerQuery(context, contextStore, query);
}
if (command instanceof ProcedureContainer) {
GroupSymbol group = ((ProcedureContainer)command).getGroup();
@@ -158,7 +162,7 @@
return null;
}
- private TupleSource registerQuery(CommandContext context, Command command,
+ private TupleSource registerQuery(CommandContext context,
TempTableStore contextStore, Query query)
throws TeiidComponentException, QueryMetadataException,
TeiidProcessingException, ExpressionEvaluationException,
@@ -185,13 +189,13 @@
}
}
table = tts.addTempTable(tableName, create, bufferManager);
+ table.setPreferMemory(tableName.startsWith(CODE_PREFIX));
boolean success = false;
try {
- String actualViewName = tableName.substring(RelationalPlanner.MAT_PREFIX.length());
- Object id = metadata.getGroupID(actualViewName);
//TODO: order by primary key nulls first - then have an insert ordered optimization
- String transformation = metadata.getVirtualPlan(id).getQuery();
- QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, actualViewName, context);
+ //TODO: use the getCommand logic in RelationalPlanner to reuse commands for this.
+ String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
+ QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, group.getCanonicalName(), context);
qp.setNonBlocking(true);
TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
//TODO: if this insert fails, it's unnecessary to do the undo processing
@@ -199,16 +203,15 @@
success = true;
} finally {
if (!success) {
- table.remove();
tts.removeTempTableByName(tableName);
}
info.setState(success?MatState.LOADED:MatState.FAILED_LOAD);
}
} else {
- table = tts.getOrCreateTempTable(tableName, command, bufferManager, false);
+ table = tts.getOrCreateTempTable(tableName, query, bufferManager, false);
}
} else {
- table = contextStore.getOrCreateTempTable(tableName, command, bufferManager, true);
+ table = contextStore.getOrCreateTempTable(tableName, query, bufferManager, true);
}
//convert to the actual table symbols (this is typically handled by the languagebridgefactory
ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
@@ -222,23 +225,38 @@
}
};
PostOrderNavigator.doVisit(query, emv);
- return table.createTupleSource(command.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
+ return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
}
- public Object lookupCodeValue(
- CommandContext context,
- String codeTableName,
- String returnElementName,
- String keyElementName,
- Object keyValue)
- throws BlockedException, TeiidComponentException, TeiidProcessingException {
-
- return this.processorDataManager.lookupCodeValue(context, codeTableName, returnElementName, keyElementName, keyValue);
+ public Object lookupCodeValue(CommandContext context, String codeTableName,
+ String returnElementName, String keyElementName, Object keyValue)
+ throws BlockedException, TeiidComponentException,
+ TeiidProcessingException {
+ ElementSymbol keyElement = new ElementSymbol(keyElementName);
+ ElementSymbol returnElement = new ElementSymbol(returnElementName);
+
+ QueryMetadataInterface metadata = context.getMetadata();
+
+ keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
+ returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
+
+ String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase();
+ TempMetadataID id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
+ String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
+ id.setQueryNode(new QueryNode(matTableName, queryString));
+ id.setPrimaryKey(id.getElements().subList(0, 1));
+
+ 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;
}
-
- @Override
- public void clearCodeTables() {
- this.processorDataManager.clearCodeTables();
- }
-
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -86,6 +86,10 @@
return updateTime;
}
+ public MatState getState() {
+ return state;
+ }
+
}
private ConcurrentHashMap<String, MatTableInfo> matTables = new ConcurrentHashMap<String, MatTableInfo>();
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -51,7 +51,7 @@
}
@Override
- public ManagedBatch createManagedBatch(final TupleBatch batch)
+ public ManagedBatch createManagedBatch(final TupleBatch batch, boolean softCache)
throws TeiidComponentException {
return new ManagedBatch() {
Deleted: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -1,249 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.dqp.internal.process.CodeTableCache;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheKey;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheState;
-import org.teiid.query.util.CommandContext;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestCodeTableCache extends TestCase {
-
- private static CommandContext TEST_CONTEXT = new CommandContext("pid", "1", null, "test", 1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private static CommandContext TEST_CONTEXT_1 = new CommandContext("pid", "1", null, "test", 2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- public TestCodeTableCache(String name) {
- super(name);
- }
-
- private static List[] exampleResultObject() {
- List record1 = Arrays.asList("US", "USA"); //$NON-NLS-1$ //$NON-NLS-2$
- List record2 = Arrays.asList("Germany", "GM"); //$NON-NLS-1$ //$NON-NLS-2$
-
- List[] records = new List[] {
- record1, record2
- };
-
- return records;
- }
-
- private CodeTableCache setUpSampleCodeTable(boolean setDone) {
- CodeTableCache ctc = new CodeTableCache(10, 10, 10);
- assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // must set the requestToCacheKeyMap first
- CacheKey nodeId = ctc.createCacheRequest("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List[] results = exampleResultObject();
-
- // table/countrycode (keyElem/country, returnElem/code);
- // r1--> 'US', 'USA'
- // r2--> 'Germany', 'GM'
-
- try {
- ctc.loadTable(nodeId, Arrays.asList(results));
- } catch (TeiidProcessingException e) {
- throw new RuntimeException(e);
- }
- ctc.markCacheDone(nodeId, setDone);
- return ctc;
- }
-
- // Max = 1 and 1 table is set up
- private CodeTableCache setUpSampleCodeTable2() {
- CodeTableCache ctc = new CodeTableCache(1, 10, 10);
- assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // must set the requestToCacheKeyMap first
- CacheKey nodeId = ctc.createCacheRequest("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List[] results = exampleResultObject();
-
- // table/countrycode (keyElem/country, returnElem/code);
- // r1--> 'US', 'USA'
- // r2--> 'Germany', 'GM'
-
- try {
- ctc.loadTable(nodeId, Arrays.asList(results));
- } catch (TeiidProcessingException e) {
- throw new RuntimeException(e);
- }
- ctc.markCacheDone(nodeId, true);
- return ctc;
- }
-
- public void testLookupValue() throws Exception {
- CodeTableCache ctc = setUpSampleCodeTable(true);
- String code = (String) ctc.lookupValue("countrycode", "code", "country", "Germany", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Actual lookup value doesn't match with expected: ", code, "GM"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /** state = 0; exists*/
- public void testCacheExists1() {
- // load code table
- CodeTableCache ctc = setUpSampleCodeTable(true);
-
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState); //$NON-NLS-1$
-
- //test case insensitive
- actualState = ctc.cacheExists("countryCODE", "code", "Country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState); //$NON-NLS-1$
- }
-
- /** state = 1; loading state */
- public void testCacheExists2() {
- CodeTableCache ctc = new CodeTableCache(10, 10, 10);
-
- ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_LOADING, actualState); //$NON-NLS-1$
- }
-
- /** state = 2; not exist */
- public void testCacheExists3() {
- CodeTableCache ctc = setUpSampleCodeTable(true);
-
- CacheState actualState = ctc.cacheExists("countrycode1", "code1", "country1", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState); //$NON-NLS-1$
- }
-
- /** state = 2; not exist */
- public void testCacheExists3a() {
- CodeTableCache ctc = setUpSampleCodeTable(false);
-
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState); //$NON-NLS-1$
- }
-
- /** state = 4; overload */
- public void testCacheOverload1() {
- CodeTableCache ctc = setUpSampleCodeTable2();
-
- CacheState actualState = ctc.cacheExists("countrycode", "something", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_OVERLOAD, actualState); //$NON-NLS-1$
- }
-
- /** test load, then clearAll, then cacheExists */
- public void testClearAllLoaded() {
- // load code table
- CodeTableCache ctc = setUpSampleCodeTable(true);
-
- // clear all code tables
- ctc.clearAll();
-
- // check state
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState); //$NON-NLS-1$
- }
-
- /** load table, cacheExists, clearAll, then lookupValue - this should throw an exception */
- public void testClearAllLoading() {
- // load code table
- CodeTableCache ctc = setUpSampleCodeTable(true);
-
- // check state
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState); //$NON-NLS-1$
-
- // clear all code tables before it can be read
- ctc.clearAll();
-
- // lookup a value - this should throw an exception
- try {
- ctc.lookupValue("countrycode", "code", "country", "US", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- fail("Expected exception during lookup"); //$NON-NLS-1$
- } catch(TeiidComponentException e) {
- // expected this
- }
- }
-
- public void testVdbSpecificCaching() {
- // load code table
- CodeTableCache ctc = setUpSampleCodeTable(true);
-
- CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT_1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState); //$NON-NLS-1$
- }
-
- public void testDuplicateKeyException() {
- CodeTableCache ctc = new CodeTableCache(1, 10, 10);
- assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // must set the requestToCacheKeyMap first
- CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List[] results = new List[] {
- Arrays.asList(1, 2),
- Arrays.asList(1, 3),
- };
-
- try {
- ctc.loadTable(nodeId, Arrays.asList(results));
- fail("expected exception"); //$NON-NLS-1$
- } catch (TeiidProcessingException e) {
- assertEquals("Duplicate code table 'table' key 'value' value '1'", e.getMessage()); //$NON-NLS-1$
- }
- }
-
- public void testMaxRecords() {
- CodeTableCache ctc = new CodeTableCache(1, 1, 10);
- assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // must set the requestToCacheKeyMap first
- CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List[] results = new List[] {
- Arrays.asList(1, 2),
- Arrays.asList(2, 3),
- };
-
- try {
- ctc.loadTable(nodeId, Arrays.asList(results));
- fail("expected exception"); //$NON-NLS-1$
- } catch (TeiidProcessingException e) {
- assertEquals("Error Code:ERR.018.005.0100 Message:Unable to load code table for because result sizes exceeds the allowed parameter - maxCodeTableRecords.", e.getMessage()); //$NON-NLS-1$
- }
- }
-
- public void testMaxRecordsPerTable() {
- CodeTableCache ctc = new CodeTableCache(10, 10, 1);
- assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // must set the requestToCacheKeyMap first
- CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List[] results = new List[] {
- Arrays.asList(1, 2),
- Arrays.asList(2, 3),
- };
-
- try {
- ctc.loadTable(nodeId, Arrays.asList(results));
- fail("expected exception"); //$NON-NLS-1$
- } catch (TeiidProcessingException e) {
- assertEquals("Error Code:ERR.018.005.0100 Message:Unable to load code table for because result sizes exceeds the allowed parameter - maxCodeTables.", e.getMessage()); //$NON-NLS-1$
- }
- }
-
-}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,7 +29,6 @@
import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.RequestMessage;
import org.teiid.common.buffer.BlockedException;
-import org.teiid.core.TeiidException;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
import org.teiid.dqp.message.AtomicRequestMessage;
@@ -84,10 +83,7 @@
dtm = new DataTierManagerImpl(rm,
repo,
- bs,
- 20,
- 1000,
- 1000);
+ bs);
command = helpGetCommand(sql, metadata);
RequestMessage original = new RequestMessage();
@@ -130,18 +126,6 @@
assertNull(info.nextTuple());
}
- @Test public void testCodeTableResponseException() throws Exception {
- helpSetup(3);
- this.connectorManager.throwExceptionOnExecute = true;
-
- try {
- dtm.lookupCodeValue(context, "BQT1.SmallA", "IntKey", "StringKey", "49"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- fail("processor should have failed"); //$NON-NLS-1$
- } catch (TeiidException e) {
- assertEquals("Connector Exception", e.getMessage()); //$NON-NLS-1$
- }
- }
-
@Test public void testNoRowsException() throws Exception {
helpSetup(3);
this.connectorManager.setRows(0);
@@ -155,11 +139,4 @@
}
}
- @Test public void testCodeTableResponseDataNotAvailable() throws Exception {
- helpSetup(3);
- this.connectorManager.dataNotAvailable = 5;
-
- assertNull(dtm.lookupCodeValue(context, "BQT1.SmallA", "IntKey", "StringKey", "49")); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -28,6 +28,7 @@
import org.teiid.cache.Cache;
import org.teiid.common.buffer.BufferManager;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.parser.ParseInfo;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
@@ -46,7 +47,7 @@
Cachable result = Mockito.mock(Cachable.class);
id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
- cache.put(id, true, false, result);
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, result);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed
@@ -70,7 +71,7 @@
Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
- cache.put(id, false, true, result);
+ cache.put(id, FunctionMethod.USER_DETERMINISTIC, result);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed
@@ -96,7 +97,7 @@
Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
- cache.put(id, false, false, result);
+ cache.put(id, FunctionMethod.VDB_DETERMINISTIC, result);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed
Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -39,18 +39,36 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.metadata.Datatype;
import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.translator.TranslatorException;
-
+@SuppressWarnings("nls")
public class TestTransformationMetadata {
@Test public void testAmbiguousProc() throws Exception {
+ TransformationMetadata tm = exampleTransformationMetadata();
+
+ try {
+ tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (QueryMetadataException e) {
+ assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ private TransformationMetadata exampleTransformationMetadata()
+ throws TranslatorException {
Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
mf.addProcedure("y"); //$NON-NLS-1$
+
+ Table t = mf.addTable("foo");
+ mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
+
MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
mf1.addProcedure("y"); //$NON-NLS-1$
CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
@@ -62,14 +80,7 @@
vdb.addModel(buildModel("x"));
vdb.addModel(buildModel("x1"));
- TransformationMetadata tm = new TransformationMetadata(vdb, cms, null, null);
-
- try {
- tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
- fail("expected exception"); //$NON-NLS-1$
- } catch (QueryMetadataException e) {
- assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
- }
+ return new TransformationMetadata(vdb, cms, null, null);
}
ModelMetaData buildModel(String name) {
@@ -115,4 +126,9 @@
assertEquals(1, result.size());
}
+ @Test public void testElementId() throws Exception {
+ TransformationMetadata tm = exampleTransformationMetadata();
+ tm.getElementID("x.FoO.coL");
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -364,9 +364,6 @@
blockOnce = true;
}
- @Override
- public void clearCodeTables() {/* does nothing */}
-
/**
* Are commands/queries that are registered with the data manager being
* recorded?
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -31,6 +31,7 @@
import org.junit.Before;
import org.junit.Test;
import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.TeiidProcessingException;
import org.teiid.dqp.internal.process.SimpleQueryProcessorFactory;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -56,10 +57,12 @@
metadata = new TempMetadataAdapter(RealMetadataFactory.exampleMaterializedView(), tempStore.getMetadataStore());
hdm = new HardcodedDataManager();
hdm.addData("SELECT matsrc.x FROM matsrc", new List[] {Arrays.asList((String)null), Arrays.asList("one"), Arrays.asList("two"), Arrays.asList("three")});
+ hdm.addData("SELECT mattable.info.e1, mattable.info.e2 FROM mattable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
+ hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
dataManager = new TempTableDataManager(hdm, BufferManagerFactory.getStandaloneBufferManager());
}
- private void execute(String sql, List[] expectedResults) throws Exception {
+ private void execute(String sql, List... expectedResults) throws Exception {
CommandContext cc = TestProcessor.createCommandContext();
cc.setTempTableStore(tempStore);
cc.setGlobalTableStore(globalStore);
@@ -71,10 +74,22 @@
}
@Test public void testPopulate() throws Exception {
- execute("SELECT * from vgroup3 where x = 'one'", new List[] {Arrays.asList("one", "zne")});
+ execute("SELECT * from vgroup3 where x = 'one'", Arrays.asList("one", "zne"));
assertEquals(1, hdm.getCommandHistory().size());
- execute("SELECT * from vgroup3 where x is null", new List[] {Arrays.asList(null, null)});
+ execute("SELECT * from vgroup3 where x is null", Arrays.asList(null, null));
assertEquals(1, hdm.getCommandHistory().size());
}
+ @Test(expected=TeiidProcessingException.class) public void testCodeTableResponseException() throws Exception {
+ //duplicate key
+ execute("select lookup('mattable.info', 'e2', 'e1', 'a')");
+ }
+
+ @Test public void testCodeTable() throws Exception {
+ execute("select lookup('mattable.info', 'e1', 'e2', 5)", Arrays.asList((String)null));
+ assertEquals(1, hdm.getCommandHistory().size());
+ execute("select lookup('mattable.info', 'e1', 'e2', 1)", Arrays.asList("a"));
+ assertEquals(1, hdm.getCommandHistory().size());
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -544,7 +544,7 @@
// Plan query
ProcessorPlan plan = TestProcedureProcessor.getProcedurePlan(sql, metadata);
// Run query
- TestProcedureProcessor.helpTestProcess(plan, expected, new FakeDataManager());
+ TestProcedureProcessor.helpTestProcess(plan, expected, new FakeDataManager(), metadata);
}
@@ -742,7 +742,7 @@
}
};
- TestProcedureProcessor.helpTestProcess(plan, expected, dataManager);
+ TestProcedureProcessor.helpTestProcess(plan, expected, dataManager, metadata);
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -32,11 +32,9 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
@@ -54,6 +52,7 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.XMLType;
+import org.teiid.dqp.internal.process.SimpleQueryProcessorFactory;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.function.FunctionTree;
@@ -61,6 +60,8 @@
import org.teiid.query.function.UDFSource;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.FakeFunctionMetadataSource;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.TestOptimizer;
@@ -149,7 +150,11 @@
static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context) throws TeiidException {
if(DEBUG) System.out.println("\n####################################\n" + command); //$NON-NLS-1$
AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
- try {
+ if (!(metadata instanceof TempMetadataAdapter)) {
+ metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+ }
+ context.setMetadata(metadata);
+ try {
QueryResolver.resolveCommand(command, metadata);
ValidatorReport repo = Validator.validate(command, metadata);
@@ -158,7 +163,7 @@
if (failures.size() > 0){
fail("Exception during validation (" + repo); //$NON-NLS-1$
}
- command = QueryRewriter.rewrite(command, metadata, createCommandContext());
+ command = QueryRewriter.rewrite(command, metadata, context);
ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
//per defect 10022, clone this plan before processing, just to make sure
@@ -231,8 +236,14 @@
if (context.getTempTableStore() == null) {
context.setTempTableStore(new TempTableStore(context.getConnectionID()));
}
+ if (context.getGlobalTableStore() == null) {
+ context.setGlobalTableStore(new TempTableStore("SYSTEM"));
+ }
if (!(dataManager instanceof TempTableDataManager)) {
dataManager = new TempTableDataManager(dataManager, bufferMgr);
+ }
+ if (context.getQueryProcessorFactory() == null) {
+ context.setQueryProcessorFactory(new SimpleQueryProcessorFactory(bufferMgr, dataManager, new DefaultCapabilitiesFinder(), null, context.getMetadata()));
}
TupleBuffer id = null;
try {
@@ -335,74 +346,11 @@
}
private void sampleData2(FakeDataManager dataMgr) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
- // Group pm1.g2
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "a", new Integer(1), Boolean.TRUE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(5), Boolean.TRUE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(2), Boolean.FALSE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "d", new Integer(2), Boolean.FALSE, new Double(1.0) }), //$NON-NLS-1$
- } );
-
- // Group pm2.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- } );
-
- // Group pm1.table1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.table1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
- } catch(TeiidException e) {
- throw new RuntimeException(e);
- }
+ try {
+ FakeDataStore.sampleData2(dataMgr);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
private void sampleData2a(FakeDataManager dataMgr) {
@@ -6756,24 +6704,19 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Plan query
- String sql = "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 1) = e1";//$NON-NLS-1$
+ String sql = "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 0) = e1";//$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
Command command = TestProcessor.helpParse(sql);
CommandContext context = createCommandContext();
- context.setMetadata(metadata);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context);
// Run query
List[] expected = new List[] {
- Arrays.asList(new Object[] { "b"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
};
FakeDataManager dataManager = new FakeDataManager();
- sampleData1(dataManager);
- Map valueMap = new HashMap();
- valueMap.put(1, "b"); //$NON-NLS-1$ //$NON-NLS-2$
- dataManager.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- dataManager.setThrowBlocked(true);
+ FakeDataStore.sampleData2(dataManager);
helpProcess(plan, context, dataManager, expected);
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -26,9 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.junit.Test;
import org.teiid.api.exception.query.QueryMetadataException;
@@ -40,12 +38,15 @@
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.FakeDataManager;
+import org.teiid.query.processor.FakeDataStore;
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.TestProcessor;
@@ -64,7 +65,7 @@
import org.teiid.query.validator.ValidatorFailure;
import org.teiid.query.validator.ValidatorReport;
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked", "nls"})
public class TestProcedureProcessor {
public static ProcessorPlan getProcedurePlan(String userQuery, FakeMetadataFacade metadata) throws Exception {
@@ -95,43 +96,30 @@
}
}
- static void helpTestProcess(ProcessorPlan procPlan, int rowsUpdated, List[] expectedResults, boolean shouldFail, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+ public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
- context.getNextRand(0);
+ if (!(metadata instanceof TempMetadataAdapter)) {
+ metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+ }
context.setMetadata(metadata);
- if (expectedResults == null) {
- expectedResults = new List[] {Arrays.asList(rowsUpdated)};
- }
-
TestProcessor.helpProcess(procPlan, context, dataMgr, expectedResults);
- if (shouldFail) {
- fail("Expected processing to fail"); //$NON-NLS-1$
- }
+ assertNotNull("Expected processing to fail", expectedResults);
}
private void helpTestProcessFailure(ProcessorPlan procPlan, FakeDataManager dataMgr,
- String failMessage) throws Exception {
+ String failMessage, QueryMetadataInterface metadata) throws Exception {
try {
- helpTestProcess(procPlan, new List[] {}, dataMgr, true);
+ helpTestProcess(procPlan, null, dataMgr, metadata);
} catch(TeiidException ex) {
assertEquals(failMessage, ex.getMessage());
}
}
- public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr) throws Exception {
- helpTestProcess(procPlan, expectedResults, dataMgr, false);
+ private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+ helpTestProcess(procPlan, new List[] {Arrays.asList(expectedRows)}, dataMgr, metadata);
}
- private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr) throws Exception {
- helpTestProcess(procPlan, expectedRows, null, false, dataMgr, null);
- }
-
- static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr,
- boolean shouldFail) throws Exception {
- helpTestProcess(procPlan, 0, expectedResults, shouldFail, dataMgr, null);
- }
-
// Helper to create a list of elements - used in creating sample data
private static List createElements(List elementIDs) {
List elements = new ArrayList();
@@ -277,7 +265,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 0, dataMgr);
+ helpTestProcess(plan, 0, dataMgr, metadata);
}
// testing if statement
@@ -300,7 +288,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
// testing if statement
@@ -324,7 +312,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
// testing rows updated incremented, Input and assignment statements
@@ -345,7 +333,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 45, dataMgr);
+ helpTestProcess(plan, 45, dataMgr, metadata);
}
// if/else test
@@ -375,7 +363,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
@Test public void testProcedureProcessor4WithBlockedException() throws Exception {
@@ -405,7 +393,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
// if/else test
@@ -432,7 +420,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 50, dataMgr);
+ helpTestProcess(plan, 50, dataMgr, metadata);
}
// more rows than expected
@@ -450,7 +438,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1"); //$NON-NLS-1$
+ helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1", metadata); //$NON-NLS-1$
}
// error statement
@@ -487,7 +475,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR"); //$NON-NLS-1$
+ helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR", metadata); //$NON-NLS-1$
}
private void helpTestErrorStatment(String errorValue, String expected) throws Exception {
@@ -507,7 +495,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected);
+ helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected, metadata);
}
/** test if statement's if block with lookup in if condition */
@@ -515,7 +503,7 @@
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
- procedure = procedure + "if('xyz' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
+ procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 0))\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
@@ -531,13 +519,10 @@
FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
FakeDataManager dataMgr = new FakeDataManager();
-
- Map valueMap = new HashMap();
- valueMap.put( new Integer(5), "xyz"); //$NON-NLS-1$
- dataMgr.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FakeDataStore.sampleData2(dataMgr);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 1, dataMgr);
+ helpTestProcess(plan, 1, dataMgr, metadata);
}
@@ -546,7 +531,7 @@
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
- procedure = procedure + "if('xy' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
+ procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
@@ -562,13 +547,10 @@
FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
FakeDataManager dataMgr = new FakeDataManager();
+ FakeDataStore.sampleData2(dataMgr);
- Map valueMap = new HashMap();
- valueMap.put( new Integer(5), "xyz"); //$NON-NLS-1$
- dataMgr.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 12, dataMgr);
+ helpTestProcess(plan, 12, dataMgr, metadata);
}
@Test public void testVirtualProcedure() throws Exception {
@@ -585,7 +567,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureWithBlockedException() throws Exception {
@@ -603,7 +585,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure2() throws Exception {
@@ -618,7 +600,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure3() throws Exception {
@@ -633,7 +615,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure4() throws Exception {
@@ -648,7 +630,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "First"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure5() throws Exception {
@@ -663,7 +645,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure6() throws Exception {
@@ -678,7 +660,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure7() throws Exception {
@@ -693,7 +675,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure8() throws Exception {
@@ -708,7 +690,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure9() throws Exception {
@@ -722,7 +704,7 @@
// Create expected results
List[] expected = new List[] {};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@@ -738,7 +720,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure11() throws Exception {
@@ -754,7 +736,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure12() throws Exception {
@@ -782,7 +764,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
//Defect17447_testVirtualProcedure13
@@ -812,7 +794,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure14() throws Exception {
@@ -826,7 +808,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure15() throws Exception {
@@ -846,7 +828,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure16() throws Exception {
@@ -883,7 +865,7 @@
Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Integer(51)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Fourth", new Integer(7)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure18() throws Exception {
@@ -898,7 +880,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Integer(51)}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure19() throws Exception {
@@ -912,7 +894,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure19WithBlockedException() throws Exception {
@@ -925,7 +907,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureNoDataInTempTable() throws Exception {
@@ -939,7 +921,7 @@
// Create expected results
List[] expected = new List[] {};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
//procedure with Has Criteria and Translate Criteria
@@ -965,7 +947,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
@Test public void testVirtualProcedure30() throws Exception {
@@ -982,7 +964,7 @@
Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure31() throws Exception {
@@ -996,7 +978,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureDefect14282() throws Exception {
@@ -1011,7 +993,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16193() throws Exception {
@@ -1025,7 +1007,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure16602() throws Exception {
@@ -1051,7 +1033,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1)})};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16649_1() throws Exception {
@@ -1065,7 +1047,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16649_2() throws Exception {
@@ -1079,7 +1061,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16694() throws Exception {
@@ -1093,7 +1075,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16707() throws Exception {
@@ -1109,7 +1091,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16707_1() throws Exception {
@@ -1125,7 +1107,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect17451() throws Exception {
@@ -1154,7 +1136,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
//Defect 17447
@@ -1172,7 +1154,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect17650() throws Exception {
@@ -1200,7 +1182,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
@Test public void testDefect19982() throws Exception {
@@ -1216,7 +1198,7 @@
Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second", new Integer(5)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testCase3521() throws Exception {
@@ -1234,7 +1216,7 @@
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
// Arrays.asList(new Object[] { "Third"}), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
//procedure with Has Criteria and Translate Criteria and changing
@@ -1261,7 +1243,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
@Test public void testDynamicCommandWithIntoExpression() throws Exception {
@@ -1290,7 +1272,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First" }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithIntoAndLoop() throws Exception {
@@ -1332,7 +1314,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(66)}),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithParameter() throws Exception {
@@ -1360,7 +1342,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithUsing() throws Exception {
@@ -1388,7 +1370,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithVariable() throws Exception {
@@ -1416,7 +1398,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithSingleSelect() throws Exception {
@@ -1443,7 +1425,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "26" }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@@ -1473,7 +1455,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { "5" }), //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandRecursion() throws Exception {
@@ -1503,7 +1485,7 @@
helpTestProcessFailure(plan,
dataMgr,
- "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL."); //$NON-NLS-1$
+ "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL.", metadata); //$NON-NLS-1$
}
@Test public void testDynamicCommandIncorrectProjectSymbolCount() throws Exception {
@@ -1533,7 +1515,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements."); //$NON-NLS-1$
+ helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements.", metadata); //$NON-NLS-1$
}
@Test public void testDynamicCommandPositional() throws Exception {
@@ -1560,7 +1542,7 @@
helpTestProcess(plan, new List[] {Arrays.asList("First", "5"), //$NON-NLS-1$ //$NON-NLS-2$
Arrays.asList("Second", "15"), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList("Third", "51")}, dataMgr); //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList("Third", "51")}, dataMgr, metadata); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
@@ -1585,7 +1567,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'."); //$NON-NLS-1$
+ helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'.", metadata); //$NON-NLS-1$
}
@Test public void testDynamicCommandWithTwoDynamicStatements() throws Exception {
@@ -1615,7 +1597,7 @@
Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testAssignmentWithCase() throws Exception {
@@ -1652,7 +1634,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(3) }),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandInsertIntoTempTableWithDifferentDatatypeFromSource() throws Exception {
@@ -1682,7 +1664,7 @@
Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithVariableOnly() throws Exception {
@@ -1709,7 +1691,7 @@
// Create expected results
List[] expected = new List[] { Arrays.asList(new Object[] { "First", new Short((short)5)})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureWithCreate() throws Exception{
@@ -1726,7 +1708,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureWithCreateAndDrop() throws Exception{
@@ -1743,7 +1725,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureWithCreateAndSelectInto() throws Exception{
@@ -1760,7 +1742,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDifferentlyScopedTempTables() throws Exception {
@@ -1803,7 +1785,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(3)}),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testLoopsWithBreak() throws Exception {
@@ -1845,7 +1827,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(76)}),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testCreateWithoutDrop() throws Exception {
@@ -1875,7 +1857,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists."); //$NON-NLS-1$
+ helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists.", metadata); //$NON-NLS-1$
}
/**
@@ -1910,7 +1892,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr);
+ helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr, metadata);
}
/**
@@ -1949,7 +1931,7 @@
// Plan query
ProcessorPlan plan = getProcedurePlan(sql, metadata);
// Run query
- helpTestProcess(plan, expected, new FakeDataManager());
+ helpTestProcess(plan, expected, new FakeDataManager(), metadata);
}
/**
@@ -1979,7 +1961,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 4, new FakeDataManager());
+ helpTestProcess(plan, 4, new FakeDataManager(), metadata);
}
/**
@@ -2017,7 +1999,7 @@
ProcessorPlan plan = getProcedurePlan(sql, metadata);
// Run query
- helpTestProcess(plan, expected, dataManager);
+ helpTestProcess(plan, expected, dataManager, metadata);
}
@Test public void testInsertAfterCreate() throws Exception {
@@ -2049,7 +2031,7 @@
helpTestProcess(plan, new List[] {
Arrays.asList(new Object[] {null}),
- Arrays.asList(new Object[] {"b"})}, dataMgr); //$NON-NLS-1$
+ Arrays.asList(new Object[] {"b"})}, dataMgr, metadata); //$NON-NLS-1$
}
@@ -2071,7 +2053,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 1, dataMgr);
+ helpTestProcess(plan, 1, dataMgr, metadata);
assertTrue(plan.requiresTransaction(false));
}
@@ -2100,7 +2082,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 1, dataMgr);
+ helpTestProcess(plan, 1, dataMgr, metadata);
}
@Test public void testEvaluatableSelectWithOrderBy() throws Exception {
@@ -2129,7 +2111,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {"1"})}, dataMgr); //$NON-NLS-1$
+ Arrays.asList(new Object[] {"1"})}, dataMgr, metadata); //$NON-NLS-1$
}
@@ -2161,7 +2143,7 @@
helpTestProcess(plan, new List[] {
Arrays.asList(new Object[] {"1"}), //$NON-NLS-1$
Arrays.asList(new Object[] {"First"}), //$NON-NLS-1$
- }, dataMgr);
+ }, dataMgr, metadata);
}
@@ -2195,9 +2177,9 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 0, new List[] {
+ helpTestProcess(plan, new List[] {
Arrays.asList(new Object[] {new Integer(240)}),
- Arrays.asList(new Object[] {new Integer(637)})}, false, dataMgr, metadata);
+ Arrays.asList(new Object[] {new Integer(637)})}, dataMgr, metadata);
}
private FakeMetadataFacade createProcedureMetadata(String procedure) {
@@ -2236,7 +2218,7 @@
helpTestProcess(plan, new List[] {
Arrays.asList(new Object[] {"5"}), //$NON-NLS-1$
- }, dataMgr);
+ }, dataMgr, metadata);
}
/**
@@ -2268,7 +2250,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { expectedDoc }),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testXMLWithExternalCriteria_InXMLVar() throws Exception {
@@ -2297,7 +2279,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { expectedDoc }),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
/**
@@ -2364,7 +2346,7 @@
List[] expected = new List[] {
Arrays.asList(new Object[] { expectedDoc }),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testCase174806() throws Exception{
@@ -2379,7 +2361,7 @@
// Create expected results
List[] expected = new List[] {
Arrays.asList(new Object[] { "c"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testJoinProcAndPhysicalModel() throws Exception {
@@ -2396,7 +2378,7 @@
Arrays.asList(new Object[] { "First"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
/**
@@ -2443,7 +2425,7 @@
ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
List[] expected = new List[] {Arrays.asList(new Object[] {new Integer(3)})};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect8693() throws Exception {
@@ -2462,7 +2444,7 @@
FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 5, dataMgr);
+ helpTestProcess(plan, 5, dataMgr, metadata);
}
@Test public void testWhileWithSubquery() throws Exception {
@@ -2480,7 +2462,7 @@
FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 0, dataMgr);
+ helpTestProcess(plan, 0, dataMgr, metadata);
}
@Test public void testDefect18404() throws Exception {
@@ -2495,7 +2477,7 @@
FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcess(plan, 8, dataMgr);
+ helpTestProcess(plan, 8, dataMgr, metadata);
}
/**
@@ -2538,7 +2520,7 @@
Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
assertTrue(!plan.requiresTransaction(false));
}
@@ -2584,7 +2566,7 @@
Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testUpdateDeleteTemp() throws Exception {
@@ -2604,7 +2586,7 @@
List[] expected = new List[] {
Arrays.asList( new Object[] { String.valueOf(1) } ),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testTempSubqueryInput() throws Exception {
@@ -2623,7 +2605,7 @@
List[] expected = new List[] {
Arrays.asList( 51 ),
};
- helpTestProcess(plan, expected, dataMgr);
+ helpTestProcess(plan, expected, dataMgr, metadata);
}
private static final boolean DEBUG = false;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -219,10 +219,6 @@
actualCommands.add(command);
return new FakeTupleSource(numExecutedCommands);
}
- @Override
- public void clearCodeTables() {
-
- }
}
private static final class FakeTupleSource implements TupleSource {
private int currentTuple = 0;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -184,10 +184,6 @@
Object val = row.get(0);
assertEquals(new Integer(value), val);
}
- @Override
- public void clearCodeTables() {
-
- }
}
private static final class FakeDataTupleSource implements TupleSource {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -55,6 +55,8 @@
import org.teiid.query.mapping.xml.MappingSequenceNode;
import org.teiid.query.mapping.xml.Namespace;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -2943,7 +2945,7 @@
try {
CommandContext planningContext = new CommandContext(); //this should be the same as the processing context, but that's not easy to do
-
+ planningContext.setMetadata(new TempMetadataAdapter(metadata, new TempMetadataStore()));
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, planningContext);
if(DEBUG) {
@@ -5492,11 +5494,6 @@
FakeMetadataFacade metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
- dataMgr.setThrowBlocked(true);
- Map values = new HashMap();
- values.put("x", "y"); //$NON-NLS-1$ //$NON-NLS-2$
- dataMgr.defineCodeTable("stock.items", "itemName", "itemNum", values); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
"<Catalogs>\r\n" + //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -280,6 +280,11 @@
Schema physModel = createPhysicalModel("MatTable", metadataStore); //$NON-NLS-1$
Schema physModel_virtSrc = createPhysicalModel("MatSrc", metadataStore); //$NON-NLS-1$
+ Table physTable = createPhysicalGroup("info", physModel); //$NON-NLS-1$
+ createElements(physTable,
+ new String[] { "e1", "e2", "e3"}, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
+
Table physGroup = createPhysicalGroup("MatTable", physModel); //$NON-NLS-1$
createElements(physGroup,
new String[] { "e1" }, //$NON-NLS-1$
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -113,7 +113,7 @@
Mockito.stub(rwi.getDqpWorkContext()).toReturn(workContext);
Mockito.stub(core.getRequestWorkItem((RequestID)Mockito.anyObject())).toReturn(rwi);
- DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, null, null, 0, 0, 0);
+ DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, null, null);
doProcess(metadata,
sql,
finder, dataMgr , new List[] {Arrays.asList(new String(ObjectConverterUtil.convertToByteArray(new FileInputStream(UnitTestUtil.getTestDataFile("test-schema.xsd")))))}, DEBUG); //$NON-NLS-1$
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -82,6 +82,7 @@
});
this.dqp.setConnectorManagerRepository(cmr);
+ this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.start(new DQPConfiguration());
this.sessionService.setDqp(this.dqp);
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2010-08-04 04:00:09 UTC (rev 2411)
@@ -143,12 +143,6 @@
checkResult("testReferenceKeyColumns", "select* FROM SYS.ReferenceKeyColumns order by PKTABLE_NAME"); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testVirtualLookup() {
- String[] expected = { "expr[string]", "null"}; //$NON-NLS-1$ //$NON-NLS-2$
- executeAndAssertResults(
- "select lookup('SYS.KeyColumns', 'RefKeyUID', 'KeyName', 'PK_PARTS')", expected); //$NON-NLS-1$
-
- }
@Test public void test_UID_OID_are_Equal() throws Exception {
execute("select distinct(UID) FROM SYS.Schemas"); //$NON-NLS-1$
14 years, 5 months
teiid SVN: r2410 - in trunk/test-integration/common/src/test: resources and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 23:22:15 -0400 (Tue, 03 Aug 2010)
New Revision: 2410
Added:
trunk/test-integration/common/src/test/resources/empty.vdb
Modified:
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
Log:
TEIID-860
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java 2010-08-04 03:16:30 UTC (rev 2409)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java 2010-08-04 03:22:15 UTC (rev 2410)
@@ -1,7 +1,5 @@
package org.teiid.systemmodel;
-import java.sql.SQLException;
-
import org.junit.Before;
import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
@@ -78,6 +76,5 @@
@Test public void test_PG_USER() throws Exception {
execute("select * FROM pg_user"); //$NON-NLS-1$
TestMMDatabaseMetaData.compareResultSet(this.internalResultSet);
- }
-
+ }
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2010-08-04 03:16:30 UTC (rev 2409)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2010-08-04 03:22:15 UTC (rev 2410)
@@ -24,6 +24,7 @@
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.*;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
import org.teiid.jdbc.FakeServer;
@@ -148,4 +149,18 @@
"select lookup('SYS.KeyColumns', 'RefKeyUID', 'KeyName', 'PK_PARTS')", expected); //$NON-NLS-1$
}
+
+ @Test public void test_UID_OID_are_Equal() throws Exception {
+ execute("select distinct(UID) FROM SYS.Schemas"); //$NON-NLS-1$
+ int uidCount = getRowCount();
+ execute("select distinct(OID) FROM SYS.Schemas"); //$NON-NLS-1$
+ int oidCount = getRowCount();
+ assertEquals(uidCount, oidCount);
+
+ execute("select distinct(UID) FROM SYS.DataTypes"); //$NON-NLS-1$
+ uidCount = getRowCount();
+ execute("select distinct(OID) FROM SYS.DataTypes"); //$NON-NLS-1$
+ oidCount = getRowCount();
+ assertEquals(uidCount, oidCount);
+ }
}
Added: trunk/test-integration/common/src/test/resources/empty.vdb
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/common/src/test/resources/empty.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 5 months
teiid SVN: r2409 - trunk/test-integration/common/src/test/java/org/teiid/jdbc.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 23:16:30 -0400 (Tue, 03 Aug 2010)
New Revision: 2409
Modified:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
Log:
TEIID-1104:
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2010-08-03 23:36:58 UTC (rev 2408)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2010-08-04 03:16:30 UTC (rev 2409)
@@ -30,6 +30,7 @@
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
import org.teiid.deployers.MetadataStoreGroup;
@@ -69,6 +70,7 @@
this.sessionService.setVDBRepository(repo);
this.dqp.setBufferService(new FakeBufferService());
+ this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.setTransactionService(new FakeTransactionService());
ConnectorManagerRepository cmr = Mockito.mock(ConnectorManagerRepository.class);
@@ -136,12 +138,13 @@
final Properties p = new Properties();
EmbeddedProfile.parseURL(embeddedURL, p);
- return new ConnectionImpl(new LocalServerConnection(p) {
+ LocalServerConnection conn = new LocalServerConnection(p) {
@Override
protected ClientServiceRegistry getClientServiceRegistry() {
return FakeServer.this;
}
- }, p, embeddedURL);
+ };
+ return new ConnectionImpl(conn, p, embeddedURL);
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java 2010-08-03 23:36:58 UTC (rev 2408)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java 2010-08-04 03:16:30 UTC (rev 2409)
@@ -68,6 +68,44 @@
private void executeTest(String sql, String[] expected){
execute(sql);
- assertResults(expected);
+ if (expected != null) {
+ assertResults(expected);
+ } else {
+ printResults(true);
+ }
}
+
+ @Test
+ public void testMergeWithEmptyVDB() throws Exception {
+ server.deployVDB("empty", UnitTestUtil.getTestDataPath() + "/empty.vdb");
+ this.internalConnection = server.createConnection("jdbc:teiid:empty");
+
+ String[] expectedBefore = {
+ "VDBName[string] SchemaName[string] Name[string] Type[string] NameInSource[string] IsPhysical[boolean] SupportsUpdates[boolean] UID[string] Cardinality[integer] Description[string] IsSystem[boolean] IsMaterialized[boolean] OID[integer]",
+ };
+
+ executeTest("select * from tables where schemaname ='BQT1'", expectedBefore); //$NON-NLS-1$
+
+ this.internalConnection.close();
+
+ server.deployVDB(VDB2, UnitTestUtil.getTestDataPath()+"/QT_Ora9DS_1.vdb");
+
+ server.mergeVDBS(VDB2, "empty");
+
+ String[] expectedAfter = {
+ "VDBName[string] SchemaName[string] Name[string] Type[string] NameInSource[string] IsPhysical[boolean] SupportsUpdates[boolean] UID[string] Cardinality[integer] Description[string] IsSystem[boolean] IsMaterialized[boolean] OID[integer]",
+ "empty BQT1 HugeA Table null true false mmuuid:7c66fc80-33d2-1dfa-9931-e83d04ce10a0 500000 null false false -70645926",
+ "empty BQT1 HugeB Table null true false mmuuid:b0369400-33f8-1dfa-9931-e83d04ce10a0 500000 null false false 1906808737",
+ "empty BQT1 LargeA Table null true false mmuuid:3976a800-33b2-1dfa-9931-e83d04ce10a0 10000 null false false 1317837587",
+ "empty BQT1 LargeB Table null true false mmuuid:5fb40600-33c3-1dfa-9931-e83d04ce10a0 10000 null false false -655406176",
+ "empty BQT1 MediumA Table null true false mmuuid:61074980-338d-1dfa-9931-e83d04ce10a0 1000 null false false -122563142",
+ "empty BQT1 MediumB Table null true false mmuuid:e24bd1c0-33a4-1dfa-9931-e83d04ce10a0 1000 null false false -1189500311",
+ "empty BQT1 SmallA Table null true false mmuuid:0968424f-e6a0-1df9-ac06-b890ff96f710 50 null false false 97548178",
+ "empty BQT1 SmallB Table null true false mmuuid:06fb8980-3377-1dfa-9931-e83d04ce10a0 50 null false false -1716729278"
+ };
+
+ this.internalConnection = server.createConnection("jdbc:teiid:empty");
+ executeTest("select * from tables where schemaname='BQT1'", expectedAfter); //$NON-NLS-1$
+
+ }
}
14 years, 5 months
teiid SVN: r2408 - in trunk: build/kits/jboss-container/deployers/teiid.deployer and 6 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 19:36:58 -0400 (Tue, 03 Aug 2010)
New Revision: 2408
Added:
trunk/engine/src/main/java/org/teiid/cache/Cachable.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
Log:
TEIID-1104: adding caching hook into JBoss Cache. If the Teiid server is started in the clustered mode and "cache manager" is available, then results set cache will use JBoss cache.
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-03 23:36:58 UTC (rev 2408)
@@ -45,6 +45,7 @@
</bean>
<bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
+ <property name="enabled">true</property>
<property name="clusteredCacheName">mvcc-shared</property>
</bean>
Modified: trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-08-03 23:36:58 UTC (rev 2408)
@@ -49,6 +49,7 @@
<property name="connectorManagerRepository"><inject bean="ConnectorManagerRepository"/></property>
<property name="translatorRepository"><inject bean="translatorRepository"/></property>
<property name="containerLifeCycleListener"><inject bean="JBossLifeCycleListener"/></property>
+ <property name="threadPool"><inject bean="jboss.system:service=ThreadPool"/></property>
<depends>SystemVDBDeployer</depends>
</bean>
Modified: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -38,6 +38,7 @@
private static final long serialVersionUID = -1992994494154581234L;
private CacheFactory delegate;
private String cacheName;
+ private boolean enabled = false;
@Override
public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
@@ -67,11 +68,18 @@
}
private Object getClusteredCache() {
- try {
- Context ctx = new InitialContext();
- return ctx.lookup("java:CacheManager"); //$NON-NLS-1$
- } catch (NamingException e) {
- return null;
- }
+ if (this.enabled) {
+ try {
+ Context ctx = new InitialContext();
+ return ctx.lookup("java:CacheManager"); //$NON-NLS-1$
+ } catch (NamingException e) {
+ return null;
+ }
+ }
+ return null;
}
+
+ public void setEnabled(boolean value) {
+ this.enabled = value;
+ }
}
Added: trunk/engine/src/main/java/org/teiid/cache/Cachable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/Cachable.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/cache/Cachable.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.cache;
+
+import org.teiid.common.buffer.BufferManager;
+
+public interface Cachable {
+
+ boolean prepare(Cache cache, BufferManager bufferManager);
+
+ boolean restore(Cache cache, BufferManager bufferManager);
+}
Property changes on: trunk/engine/src/main/java/org/teiid/cache/Cachable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -52,6 +52,9 @@
// Optional state
private boolean terminationFlag = false;
+ // for distributed cache purposes
+ private String[] preservedTypes;
+
/**
* Contains ordered data types of each of the columns in the batch. Although it is not serialized,
* this array is a serialization aid and must be set before serialization and deserialization using
@@ -174,6 +177,10 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
terminationFlag = in.readBoolean();
+ preservedTypes = (String[])in.readObject();
+ if (types == null) {
+ types = preservedTypes;
+ }
tuples = new ArrayList<List>();
for (List tuple : BatchSerializer.readBatch(in, types)) {
tuples.add(tuple);
@@ -181,11 +188,16 @@
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean(terminationFlag);
+ out.writeObject(this.preservedTypes);
BatchSerializer.writeBatch(out, types, getAllTuples());
}
public void setRowOffset(int rowOffset) {
this.rowOffset = rowOffset;
}
+
+ public void preserveTypes() {
+ this.preservedTypes = types;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -201,11 +201,11 @@
Assertion.isNotNull(entry);
BatchManager.ManagedBatch batch = entry.getValue();
result = batch.getBatch(!forwardOnly, types);
- result.setDataTypes(types);
if (forwardOnly) {
batches.remove(entry.getKey());
}
}
+ result.setDataTypes(types);
if (isFinal && result.getEndRow() == rowCount) {
result.setTerminationFlag(true);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -23,18 +23,37 @@
package org.teiid.dqp.internal.process;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import org.teiid.cache.Cachable;
+import org.teiid.cache.Cache;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.util.Assertion;
+import org.teiid.dqp.DQPPlugin;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.sql.lang.Command;
-public class CachedResults implements Serializable {
+public class CachedResults implements Serializable, Cachable {
private static final long serialVersionUID = -5603182134635082207L;
+
private Command command;
private AnalysisRecord analysisRecord;
- private TupleBuffer results;
+ private transient TupleBuffer results;
+ private List<?> schema;
+ private int batchSize;
+
+ protected ArrayList<UUID> cachedBatches = new ArrayList<UUID>();
+
public AnalysisRecord getAnalysisRecord() {
return analysisRecord;
}
@@ -49,6 +68,8 @@
public void setResults(TupleBuffer results) {
this.results = results;
+ this.schema = results.getSchema();
+ this.batchSize = results.getBatchSize();
}
public void setCommand(Command command) {
@@ -58,5 +79,44 @@
public Command getCommand() {
return command;
}
-
+
+ @Override
+ public boolean prepare(Cache cache, BufferManager bufferManager) {
+ Assertion.assertTrue(!this.results.isForwardOnly());
+ try {
+ for (int row = 1; row <= this.results.getRowCount(); row+=this.results.getBatchSize()) {
+ TupleBatch batch = results.getBatch(row);
+ UUID uuid = java.util.UUID.randomUUID();
+ batch.preserveTypes();
+ cache.put(uuid, batch);
+ this.cachedBatches.add(uuid);
+ }
+ return true;
+ } catch (TeiidComponentException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, DQPPlugin.Util.getString("failed_to_put_in_cache")); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ @Override
+ public synchronized boolean restore(Cache cache, BufferManager bufferManager) {
+ try {
+ if (this.results == null) {
+ TupleBuffer buffer = bufferManager.createTupleBuffer(this.schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
+ buffer.setBatchSize(this.batchSize);
+
+ for (UUID uuid : this.cachedBatches) {
+ TupleBatch batch = (TupleBatch)cache.get(uuid);
+ if (batch != null) {
+ buffer.addTupleBatch(batch, true);
+ }
+ }
+ this.results = buffer;
+ }
+ return true;
+ } catch (TeiidComponentException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, DQPPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
+ }
+ return false;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -649,10 +649,12 @@
//result set cache
if (config.isResultSetCacheEnabled()) {
this.rsCache = new SessionAwareCache<CachedResults>(config.getResultSetCacheMaxEntries(), this.cacheFactory, Cache.Type.RESULTSET);
+ this.rsCache.setBufferManager(this.bufferManager);
}
//prepared plan cache
prepPlanCache = new SessionAwareCache<PreparedPlan>(config.getPreparedPlanCacheMaxCount(), this.cacheFactory, Cache.Type.PREPAREDPLAN);
+ prepPlanCache.setBufferManager(this.bufferManager);
//get buffer manager
this.bufferManager = bufferService.getBufferManager();
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -27,10 +27,13 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+import org.teiid.cache.Cachable;
import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCache;
import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
import org.teiid.query.parser.ParseInfo;
@@ -50,6 +53,8 @@
private AtomicInteger cacheHit = new AtomicInteger();
+ private BufferManager bufferManager;
+
SessionAwareCache(){
this(DEFAULT_MAX_SIZE_TOTAL, new DefaultCacheFactory(), Cache.Type.RESULTSET);
}
@@ -65,27 +70,38 @@
this.maxSize = maxSize;
this.localCache = new DefaultCache<CacheID, T>("local", maxSize); //$NON-NLS-1$
- this.distributedCache = localCache;
-
-// if (type == Cache.Type.PREPAREDPLAN) {
-// this.distributedCache = localCache;
-// }
-// else {
-// this.distributedCache = cacheFactory.get(type, new CacheConfiguration(CacheConfiguration.Policy.LRU, -1, SessionAwareCache.this.maxSize));
-// }
+ if (type == Cache.Type.PREPAREDPLAN) {
+ this.distributedCache = localCache;
+ }
+ else {
+ this.distributedCache = cacheFactory.get(type, new CacheConfiguration(CacheConfiguration.Policy.LRU, -1, SessionAwareCache.this.maxSize));
+ }
}
public T get(CacheID id){
+
id.setSessionId(id.originalSessionId);
T result = localCache.get(id);
+
if (result == null) {
id.setSessionId(null);
+
+ id.setUserName(id.originalUserName);
result = distributedCache.get(id);
+
if (result == null) {
id.setUserName(null);
result = distributedCache.get(id);
}
+
+ if (result != null && result instanceof Cachable) {
+ Cachable c = (Cachable)result;
+ if (!c.restore(this.distributedCache, this.bufferManager)) {
+ result = null;
+ }
+ }
}
+
if (result != null) {
cacheHit.getAndIncrement();
}
@@ -103,15 +119,32 @@
if (!id.cachable) {
return;
}
+
if (sessionSpecific) {
id.setSessionId(id.originalSessionId);
this.localCache.put(id, t);
- } else {
+ }
+ else {
+
+ boolean insert = true;
+
id.setSessionId(null);
- if (!userSpecific) {
+
+ if (userSpecific) {
+ id.setUserName(id.originalUserName);
+ }
+ else {
id.setUserName(null);
}
- this.distributedCache.put(id, t);
+
+ if (t instanceof Cachable) {
+ Cachable c = (Cachable)t;
+ insert = c.prepare(this.distributedCache, this.bufferManager);
+ }
+
+ if (insert) {
+ this.distributedCache.put(id, t);
+ }
}
}
@@ -132,15 +165,16 @@
private String sessionId;
private String originalSessionId;
private List<Serializable> parameters;
- //private String userName;
- boolean cachable = true;
+ private String userName;
+ private String originalUserName;
+ private boolean cachable = true;
CacheID(DQPWorkContext context, ParseInfo pi, String sql){
this.sql = sql;
this.vdbInfo = new VDBKey(context.getVdbName(), context.getVdbVersion());
this.pi = pi;
this.originalSessionId = context.getSessionId();
- //this.userName = context.getUserName();
+ this.originalUserName = context.getUserName();
}
private void setSessionId(String sessionId) {
@@ -162,7 +196,7 @@
}
public void setUserName(String name) {
- //this.userName = name;
+ this.userName = name;
}
public boolean equals(Object obj){
@@ -174,19 +208,18 @@
}
CacheID that = (CacheID)obj;
return this.pi.equals(that.pi) && this.vdbInfo.equals(that.vdbInfo) && this.sql.equals(that.sql)
- //&& EquivalenceUtil.areEqual(this.userName, that.userName)
+ && EquivalenceUtil.areEqual(this.userName, that.userName)
&& EquivalenceUtil.areEqual(this.sessionId, that.sessionId)
&& EquivalenceUtil.areEqual(this.parameters, that.parameters);
}
public int hashCode() {
- return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, sessionId, parameters);
+ return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, this.userName, sessionId, parameters);
}
@Override
public String toString() {
- return "Cache Entry<" + originalSessionId + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+ return "Cache Entry<" + originalSessionId + "="+ originalUserName + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
@@ -198,4 +231,7 @@
return maxSize;
}
+ public void setBufferManager(BufferManager bufferManager) {
+ this.bufferManager = bufferManager;
+ }
}
Modified: trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/main/resources/org/teiid/dqp/i18n.properties 2010-08-03 23:36:58 UTC (rev 2408)
@@ -521,4 +521,6 @@
translator_not_found=Translator {0} not accessible.
datasource_not_found=Data Source {0} not accessible.
failed_to_bind_translator=Failed to bind the translator {0} on the jndi tree
-failed_to_unbind_translator=Failed to un-bind the translator {0} from the jndi tree.
\ No newline at end of file
+failed_to_unbind_translator=Failed to un-bind the translator {0} from the jndi tree.
+not_found_cache=Results not found in cache
+failed_to_put_in_cache=Failed to put results in the cache
\ No newline at end of file
Added: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.dqp.internal.process;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.teiid.cache.Cache;
+import org.teiid.cache.DefaultCache;
+import org.teiid.common.buffer.BatchManager;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.service.FakeBufferService;
+import org.teiid.query.sql.symbol.ElementSymbol;
+
+
+public class TestCachedResults {
+
+ private final class FakeBatchManager implements BatchManager {
+ @Override
+ public void remove() {
+
+ }
+
+ @Override
+ public ManagedBatch createManagedBatch(final TupleBatch batch)
+ throws TeiidComponentException {
+ return new ManagedBatch() {
+
+ @Override
+ public void remove() {
+
+ }
+
+ @Override
+ public TupleBatch getBatch(boolean cache, String[] types)
+ throws TeiidComponentException {
+ return batch;
+ }
+ };
+ }
+ }
+
+ @Test
+ public void testCaching() throws Exception {
+ FakeBufferService fbs = new FakeBufferService();
+
+ ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
+ x.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ List<ElementSymbol> schema = Arrays.asList(x);
+ TupleBuffer tb = new TupleBuffer(new FakeBatchManager(), "x", schema, null, 4); //$NON-NLS-1$
+ tb.setForwardOnly(false);
+
+ tb.addTuple(Arrays.asList(1));
+ tb.addTuple(Arrays.asList(2));
+ tb.addTuple(Arrays.asList(3));
+ tb.addTuple(Arrays.asList(4));
+ tb.addTuple(Arrays.asList(5));
+ tb.addTuple(Arrays.asList(6));
+ tb.addTuple(Arrays.asList(7));
+ tb.addTuple(Arrays.asList(8));
+ tb.addTuple(Arrays.asList(9));
+ tb.addTuple(Arrays.asList(10));
+
+ tb.close();
+
+ CachedResults results = new CachedResults();
+ results.setResults(tb);
+
+ Cache cache = new DefaultCache("dummy", 250); //$NON-NLS-1$
+ results.prepare(cache, fbs.getBufferManager());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(results);
+ oos.close();
+
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
+ CachedResults cachedResults = (CachedResults)ois.readObject();
+ ois.close();
+
+ cachedResults.restore(cache, fbs.getBufferManager());
+
+ // since restored, simulate a async cache flush
+ cache.clear();
+
+ TupleBuffer cachedTb = cachedResults.getResults();
+
+ assertEquals(tb.getRowCount(), cachedTb.getRowCount());
+ assertEquals(tb.getBatchSize(), cachedTb.getBatchSize());
+
+ assertArrayEquals(tb.getBatch(1).getAllTuples(), cachedTb.getBatch(1).getAllTuples());
+ assertArrayEquals(tb.getBatch(9).getAllTuples(), cachedTb.getBatch(9).getAllTuples());
+ }
+}
Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -34,6 +34,7 @@
import org.junit.Test;
import org.mockito.Mockito;
import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -56,6 +57,7 @@
core = new DQPCore();
core.setBufferService(new FakeBufferService());
+ core.setCacheFactory(new DefaultCacheFactory());
core.setConnectorManagerRepository(repo);
core.setTransactionService(new FakeTransactionService());
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-08-03 19:14:04 UTC (rev 2407)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -26,6 +26,7 @@
import org.junit.Test;
import org.mockito.Mockito;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.RequestMessage;
import org.teiid.common.buffer.BlockedException;
import org.teiid.core.TeiidException;
@@ -73,6 +74,7 @@
rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
rm.setBufferService(new FakeBufferService());
+ rm.setCacheFactory(new DefaultCacheFactory());
rm.start(new DQPConfiguration());
FakeBufferService bs = new FakeBufferService();
Added: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java 2010-08-03 23:36:58 UTC (rev 2408)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.dqp.internal.process;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.cache.Cachable;
+import org.teiid.cache.Cache;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.query.parser.ParseInfo;
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+
+
+@SuppressWarnings("nls")
+public class TestSessionAwareCache {
+
+ @Test
+ public void testSessionSpecfic() {
+
+ SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+
+ CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+
+ Cachable result = Mockito.mock(Cachable.class);
+
+ id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+ cache.put(id, true, false, result);
+
+ // make sure that in the case of session specific; we do not call prepare
+ // as session is local only call for distributed
+ Mockito.verify(result, times(0)).prepare((Cache)anyObject(), (BufferManager)anyObject());
+
+ Object c = cache.get(id);
+
+ Mockito.verify(result, times(0)).restore((Cache)anyObject(), (BufferManager)anyObject());
+
+ assertTrue(result==c);
+ }
+
+ @Test
+ public void testUserSpecfic() {
+
+ SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+
+ CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+
+ Cachable result = Mockito.mock(Cachable.class);
+ Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
+ Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
+
+ cache.put(id, false, true, result);
+
+ // make sure that in the case of session specific; we do not call prepare
+ // as session is local only call for distributed
+ Mockito.verify(result, times(1)).prepare((Cache)anyObject(), (BufferManager)anyObject());
+
+ id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+
+ Object c = cache.get(id);
+
+ Mockito.verify(result, times(1)).restore((Cache)anyObject(), (BufferManager)anyObject());
+
+ assertTrue(result==c);
+ }
+
+ @Test
+ public void testNoScope() {
+
+ SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
+
+ CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+
+ Cachable result = Mockito.mock(Cachable.class);
+ Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
+ Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
+
+ cache.put(id, false, false, result);
+
+ // make sure that in the case of session specific; we do not call prepare
+ // as session is local only call for distributed
+ Mockito.verify(result, times(1)).prepare((Cache)anyObject(), (BufferManager)anyObject());
+
+ id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
+
+ Object c = cache.get(id);
+
+ Mockito.verify(result, times(1)).restore((Cache)anyObject(), (BufferManager)anyObject());
+
+ assertTrue(result==c);
+ }
+
+
+ public static DQPWorkContext buildWorkContext() {
+ DQPWorkContext workContext = new DQPWorkContext();
+ SessionMetadata session = new SessionMetadata();
+ workContext.setSession(session);
+ session.setVDBName("vdb-name"); //$NON-NLS-1$
+ session.setVDBVersion(1);
+ session.setSessionId(String.valueOf(1));
+ session.setUserName("foo"); //$NON-NLS-1$
+ return workContext;
+ }
+}
Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 5 months
teiid SVN: r2407 - trunk/jboss-integration/src/main/java/org/teiid/templates/connector.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 15:14:04 -0400 (Tue, 03 Aug 2010)
New Revision: 2407
Modified:
trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
Log:
TEIID-1183: The connection interface was 'Executionfactory' before the the split between the Translator & Resource Adapter. The code that gets the property metadata from RAR file is still looking for the "connection definition" under "ExecutionFactory", which is wrong. It should be looking for "javax.resource.cci.ConnectionFactory". How there is still a risk if a customer uses a different connection factory than this one to develop or use a connection factory then Teiid will not be able to create the template files correctly.
Modified: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2010-08-03 19:04:59 UTC (rev 2406)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2010-08-03 19:14:04 UTC (rev 2407)
@@ -80,7 +80,9 @@
ObjectName on = new ObjectName("jboss.jca:service=RARDeployment,name='"+rarName+"'");//$NON-NLS-1$ //$NON-NLS-2$
ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on, "MetaData");//$NON-NLS-1$
ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition(ConnectionFactory.class.getName());
- return metadata.getProperties();
+ if (metadata != null) {
+ return metadata.getProperties();
+ }
} catch (MalformedObjectNameException e) {
//ignore
} catch (AttributeNotFoundException e) {
14 years, 5 months
teiid SVN: r2406 - trunk/jboss-integration/src/main/java/org/teiid/templates/connector.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 15:04:59 -0400 (Tue, 03 Aug 2010)
New Revision: 2406
Modified:
trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
Log:
TEIID-1183: The connection interface was 'Executionfactory' before the the split between the Translator & Resource Adapter. The code that gets the property metadata from RAR file is still looking for the "connection definition" under "ExecutionFactory", which is wrong. It should be looking for "javax.resource.cci.ConnectionFactory". How there is still a risk if a customer uses a different connection factory than this one to develop or use a connection factory then Teiid will not be able to create the template files correctly.
Modified: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2010-08-03 18:00:54 UTC (rev 2405)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2010-08-03 19:04:59 UTC (rev 2406)
@@ -33,6 +33,7 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
+import javax.resource.cci.ConnectionFactory;
import org.jboss.managed.api.Fields;
import org.jboss.managed.api.ManagedProperty;
@@ -46,7 +47,6 @@
import org.teiid.adminapi.jboss.ManagedUtil;
import org.teiid.deployers.ExtendedPropertyMetadata;
import org.teiid.deployers.ManagedPropertyUtil;
-import org.teiid.translator.ExecutionFactory;
public class RaXmlPropertyConverter {
@@ -79,7 +79,7 @@
MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
ObjectName on = new ObjectName("jboss.jca:service=RARDeployment,name='"+rarName+"'");//$NON-NLS-1$ //$NON-NLS-2$
ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on, "MetaData");//$NON-NLS-1$
- ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition(ExecutionFactory.class.getName());
+ ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition(ConnectionFactory.class.getName());
return metadata.getProperties();
} catch (MalformedObjectNameException e) {
//ignore
14 years, 5 months
teiid SVN: r2405 - trunk/runtime/src/main/java/org/teiid/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-03 14:00:54 -0400 (Tue, 03 Aug 2010)
New Revision: 2405
Modified:
trunk/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
Log:
TEIID-1182: Modifying the VDBDeployer to scan all the directories for XMI files that may be UDF function libraries. Based on the "path" information provided in the "vdb.xml" that xmi file is loaded into teiid query engine.
Modified: trunk/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java 2010-08-03 17:30:45 UTC (rev 2404)
+++ trunk/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java 2010-08-03 18:00:54 UTC (rev 2405)
@@ -69,7 +69,15 @@
metadata.put(clazz, instances);
}
Object instance = parse(unit, clazz, file, root);
- instances.add(instance);
+ boolean found = false;
+ for (Object obj:instances) {
+ if (obj == instance) {
+ found = true;
+ }
+ }
+ if (!found) {
+ instances.add(instance);
+ }
}
return mergeMetaData(unit, root, metadata, missingFiles);
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2010-08-03 17:30:45 UTC (rev 2404)
+++ trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2010-08-03 18:00:54 UTC (rev 2405)
@@ -47,7 +47,13 @@
void buildFunctionModelFile(String name) throws IOException, JAXBException {
- VirtualFile file = this.files.get(name);
+ for (String f:files.keySet()) {
+ if (f.endsWith(name)) {
+ name = f;
+ break;
+ }
+ }
+ VirtualFile file =this.files.get(name);
if (file != null) {
this.methods.addAll(FunctionMetadataReader.loadFunctionMethods(file.openStream()));
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-08-03 17:30:45 UTC (rev 2404)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-08-03 18:00:54 UTC (rev 2405)
@@ -90,10 +90,12 @@
root = unit.getAttachment(UDFMetaData.class);
if (root == null) {
root = new UDFMetaData();
+ unit.addAttachment(UDFMetaData.class, UDFMetaData.class.cast(root));
}
}
UDFMetaData udf = UDFMetaData.class.cast(root);
udf.addModelFile(file);
+
return expectedType.cast(udf);
}
else if (expectedType.equals(IndexMetadataFactory.class)) {
@@ -126,6 +128,7 @@
protected VDBMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception {
VDBMetaData vdb = getInstance(metadata, VDBMetaData.class);
UDFMetaData udf = getInstance(metadata, UDFMetaData.class);
+ IndexMetadataFactory imf = getInstance(metadata, IndexMetadataFactory.class);
if (vdb == null) {
LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",unit.getRoot().getName())); //$NON-NLS-1$
@@ -135,22 +138,18 @@
vdb.setUrl(unit.getRoot().toURL().toExternalForm());
// build the metadata store
- List<Object> indexFiles = metadata.get(IndexMetadataFactory.class);
- if (indexFiles != null && !indexFiles.isEmpty()) {
- IndexMetadataFactory imf = (IndexMetadataFactory)indexFiles.get(0);
- if (imf != null) {
- imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
- unit.addAttachment(IndexMetadataFactory.class, imf);
-
- // add the cached store.
- File cacheFile = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
- MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
- if (stores == null) {
- stores = new MetadataStoreGroup();
- stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
- }
- unit.addAttachment(MetadataStoreGroup.class, stores);
+ if (imf != null) {
+ imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
+ unit.addAttachment(IndexMetadataFactory.class, imf);
+
+ // add the cached store.
+ File cacheFile = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
+ MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
+ if (stores == null) {
+ stores = new MetadataStoreGroup();
+ stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
}
+ unit.addAttachment(MetadataStoreGroup.class, stores);
}
if (udf != null) {
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2010-08-03 17:30:45 UTC (rev 2404)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2010-08-03 18:00:54 UTC (rev 2405)
@@ -22,6 +22,8 @@
package org.teiid.deployers;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
@@ -36,7 +38,7 @@
public VDBStructure(){
setRelativeOrder(1000);
- JarUtils.addJarSuffix(".vdb");
+ JarUtils.addJarSuffix(".vdb"); //$NON-NLS-1$
}
@Override
@@ -44,9 +46,9 @@
VirtualFile file = structureContext.getFile();
try {
if (isLeaf(file) == false) {
- if (file.getName().endsWith(".vdb")) {
+ if (file.getName().endsWith(".vdb")) { //$NON-NLS-1$
- VirtualFile metainf = file.getChild("META-INF");
+ VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
if (metainf == null) {
return false;
}
@@ -54,12 +56,22 @@
if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
return false;
}
- createContext(structureContext, new String[] {"/", "META-INF", "runtime-inf"});
+
+ List<String> scanDirs = new ArrayList<String>();
+ scanDirs.add("/"); //$NON-NLS-1$
+
+ List<VirtualFile> children = file.getChildren();
+ for (VirtualFile child:children) {
+ if (!child.isLeaf()) {
+ scanDirs.add(child.getName());
+ }
+ }
+ createContext(structureContext, scanDirs.toArray(new String[scanDirs.size()]));
return true;
}
}
} catch (IOException e) {
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e); //$NON-NLS-1$
}
return false;
}
14 years, 5 months
teiid SVN: r2404 - in trunk: adminshell and 34 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-03 13:30:45 -0400 (Tue, 03 Aug 2010)
New Revision: 2404
Modified:
trunk/adminshell/pom.xml
trunk/api/pom.xml
trunk/build/pom.xml
trunk/cache-jbosscache/pom.xml
trunk/client/pom.xml
trunk/common-core/pom.xml
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-ws/pom.xml
trunk/connectors/pom.xml
trunk/connectors/salesforce-api/pom.xml
trunk/connectors/sandbox/pom.xml
trunk/connectors/sandbox/translator-yahoo/pom.xml
trunk/connectors/translator-file/pom.xml
trunk/connectors/translator-jdbc/pom.xml
trunk/connectors/translator-ldap/pom.xml
trunk/connectors/translator-loopback/pom.xml
trunk/connectors/translator-salesforce/pom.xml
trunk/connectors/translator-ws/pom.xml
trunk/console/pom.xml
trunk/documentation/admin-guide/pom.xml
trunk/documentation/client-developers-guide/pom.xml
trunk/documentation/developer-guide/pom.xml
trunk/documentation/pom.xml
trunk/documentation/quick-start-example/pom.xml
trunk/documentation/reference/pom.xml
trunk/engine/pom.xml
trunk/hibernate-dialect/pom.xml
trunk/jboss-integration/pom.xml
trunk/metadata/pom.xml
trunk/pom.xml
trunk/runtime/pom.xml
trunk/test-integration/common/pom.xml
trunk/test-integration/db/pom.xml
trunk/test-integration/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/adminshell/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/api/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/build/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>build</artifactId>
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/cache-jbosscache/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/client/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: trunk/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/common-core/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/connector-file/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/connector-ldap/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/connector-salesforce/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: trunk/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/connector-ws/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/salesforce-api/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: trunk/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/sandbox/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: trunk/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/sandbox/translator-yahoo/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: trunk/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-file/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: trunk/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-jdbc/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: trunk/connectors/translator-ldap/pom.xml
===================================================================
--- trunk/connectors/translator-ldap/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-ldap/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: trunk/connectors/translator-loopback/pom.xml
===================================================================
--- trunk/connectors/translator-loopback/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-loopback/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-salesforce/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: trunk/connectors/translator-ws/pom.xml
===================================================================
--- trunk/connectors/translator-ws/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/connectors/translator-ws/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/console/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/documentation/admin-guide/pom.xml
===================================================================
--- trunk/documentation/admin-guide/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/admin-guide/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: trunk/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/client-developers-guide/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: trunk/documentation/developer-guide/pom.xml
===================================================================
--- trunk/documentation/developer-guide/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/developer-guide/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/documentation/quick-start-example/pom.xml
===================================================================
--- trunk/documentation/quick-start-example/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/quick-start-example/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: trunk/documentation/reference/pom.xml
===================================================================
--- trunk/documentation/reference/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/documentation/reference/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/engine/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: trunk/hibernate-dialect/pom.xml
===================================================================
--- trunk/hibernate-dialect/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/hibernate-dialect/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/jboss-integration/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -2,13 +2,13 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-jboss-integration</artifactId>
<name>teiid-jboss-integration</name>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
<description>JBoss specific integration layer for teiid</description>
<dependencies>
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/metadata/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -5,15 +5,15 @@
<artifactId>teiid</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-7.1.0.CR1</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-7.1.0.CR1</developerConnection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
</scm>
<licenses>
<license>
Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/runtime/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/test-integration/common/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/test-integration/db/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -19,7 +19,7 @@
<groupId>org.jboss.teiid.teiid-test-integration</groupId>
<description>Integration tests that require external database dependencies </description>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
<dependencies>
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2010-08-03 17:29:44 UTC (rev 2403)
+++ trunk/test-integration/pom.xml 2010-08-03 17:30:45 UTC (rev 2404)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.1.0.CR1</version>
+ <version>7.1.0.CR2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
14 years, 5 months