[teiid-commits] teiid SVN: r2964 - in trunk/engine/src: main/java/org/teiid/query/function and 7 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Mar 4 12:08:12 EST 2011
Author: shawkins
Date: 2011-03-04 12:08:11 -0500 (Fri, 04 Mar 2011)
New Revision: 2964
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/BatchedUpdateNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/LimitNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestLimitNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
Log:
TEIID-1473 adding engine compensation for non-pushed limits
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 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -118,7 +118,7 @@
this.bufferService = bufferService;
}
- public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID) throws TeiidComponentException, TeiidProcessingException {
+ public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit) throws TeiidComponentException, TeiidProcessingException {
RequestWorkItem workItem = requestMgr.getRequestWorkItem((RequestID)context.getProcessorID());
if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) {
@@ -126,9 +126,13 @@
}
AtomicRequestMessage aqr = createRequest(context.getProcessorID(), command, modelName, connectorBindingId, nodeID);
+ if (limit > 0) {
+ aqr.setFetchSize(Math.min(limit, aqr.getFetchSize()));
+ throw new AssertionError();
+ }
ConnectorManagerRepository cmr = workItem.getDqpWorkContext().getVDB().getAttachment(ConnectorManagerRepository.class);
ConnectorWork work = cmr.getConnectorManager(aqr.getConnectorName()).registerRequest(aqr);
- return new DataTierTupleSource(aqr, workItem, work, this);
+ return new DataTierTupleSource(aqr, workItem, work, this, limit);
}
/**
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -80,6 +80,8 @@
private boolean[] convertToDesiredRuntimeType;
private Class<?>[] schema;
+ private int limit = -1;
+
// Data state
private int index;
private int rowsProcessed;
@@ -93,11 +95,12 @@
private volatile ResultsFuture<AtomicResultsMessage> futureResult;
private volatile boolean running;
- public DataTierTupleSource(AtomicRequestMessage aqr, RequestWorkItem workItem, ConnectorWork cwi, DataTierManagerImpl dtm) {
+ public DataTierTupleSource(AtomicRequestMessage aqr, RequestWorkItem workItem, ConnectorWork cwi, DataTierManagerImpl dtm, int limit) {
this.aqr = aqr;
this.workItem = workItem;
this.cwi = cwi;
this.dtm = dtm;
+ this.limit = limit;
List<SingleElementSymbol> symbols = this.aqr.getCommand().getProjectedSymbols();
this.schema = new Class[symbols.size()];
this.convertToDesiredRuntimeType = new boolean[symbols.size()];
@@ -224,6 +227,11 @@
receiveResults(results);
}
if (index < arm.getResults().length) {
+ if (limit-- == 0) {
+ this.done = true;
+ arm = null;
+ return null;
+ }
return correctTypes(this.arm.getResults()[index++]);
}
arm = null;
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -920,16 +920,10 @@
StringBuffer translated = new StringBuffer(str.length());
for(int i=0; i<str.length(); i++) {
char c = str.charAt(i);
- boolean matched = false;
- for(int j=0; j<in.length(); j++) {
- char inChar = in.charAt(j);
- if(c == inChar) {
- translated.append(out.charAt(j));
- matched = true;
- break;
- }
- }
- if(! matched) {
+ int j = in.indexOf(c);
+ if (j >= 0) {
+ translated.append(out.charAt(j));
+ } else {
translated.append(c);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -32,7 +32,7 @@
public interface ProcessorDataManager {
- TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID)
+ TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit)
throws TeiidComponentException, TeiidProcessingException;
/**
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -22,8 +22,7 @@
package org.teiid.query.processor.relational;
-import static org.teiid.query.analysis.AnalysisRecord.PROP_MODEL_NAME;
-import static org.teiid.query.analysis.AnalysisRecord.PROP_SQL;
+import static org.teiid.query.analysis.AnalysisRecord.*;
import java.util.ArrayList;
import java.util.Collections;
@@ -194,7 +193,12 @@
private void registerRequest(Command atomicCommand)
throws TeiidComponentException, TeiidProcessingException {
- tupleSource = getDataManager().registerRequest(getContext(), atomicCommand, modelName, connectorBindingId, getID());
+ int limit = -1;
+ if (getParent() instanceof LimitNode) {
+ LimitNode parent = (LimitNode)getParent();
+ limit = parent.getLimit() + parent.getOffset();
+ }
+ tupleSource = getDataManager().registerRequest(getContext(), atomicCommand, modelName, connectorBindingId, getID(), limit);
}
protected boolean processCommandsIndividually() {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/BatchedUpdateNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/BatchedUpdateNode.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/BatchedUpdateNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -114,7 +114,7 @@
}
if (!commandsToExecute.isEmpty()) {
BatchedUpdateCommand command = new BatchedUpdateCommand(commandsToExecute);
- tupleSource = getDataManager().registerRequest(getContext(), command, modelName, null, getID());
+ tupleSource = getDataManager().registerRequest(getContext(), command, modelName, null, getID(), -1);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/LimitNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/LimitNode.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/LimitNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -56,6 +56,12 @@
TeiidComponentException,
TeiidProcessingException {
TupleBatch batch = null; // Can throw BlockedException
+
+ if (limit == 0) {
+ this.terminateBatches();
+ return pullBatch();
+ }
+
// If we haven't reached the offset, then skip rows/batches
if (offsetPhase) {
while (rowCounter <= offset) {
@@ -107,13 +113,14 @@
}
public void open() throws TeiidComponentException, TeiidProcessingException {
- super.open();
limit = -1;
if (limitExpr != null) {
Integer limitVal = (Integer)new Evaluator(Collections.emptyMap(), getDataManager(), getContext()).evaluate(limitExpr, Collections.emptyList());
limit = limitVal.intValue();
}
-
+ if (limit == 0) {
+ return;
+ }
if (offsetExpr != null) {
Integer offsetVal = (Integer)new Evaluator(Collections.emptyMap(), getDataManager(), getContext()).evaluate(offsetExpr, Collections.emptyList());
offset = offsetVal.intValue();
@@ -121,6 +128,7 @@
offset = 0;
}
offsetPhase = offset > 0;
+ super.open();
}
public void reset() {
@@ -163,5 +171,13 @@
public Expression getOffsetExpr() {
return offsetExpr;
}
+
+ public int getLimit() {
+ return limit;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -228,7 +228,7 @@
}
private void registerRequest(Command command) throws TeiidComponentException, TeiidProcessingException {
- tupleSource = getDataManager().registerRequest(getContext(), command, this.modelName, null, getID());
+ tupleSource = getDataManager().registerRequest(getContext(), command, this.modelName, null, getID(), -1);
}
private void closeRequest() {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -23,7 +23,6 @@
package org.teiid.query.processor.relational;
import org.teiid.api.exception.query.ExpressionEvaluationException;
-import org.teiid.common.buffer.BlockedException;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.eval.Evaluator;
import org.teiid.query.sql.lang.Command;
@@ -49,29 +48,11 @@
}
/**
- * Assuming there are no elements in the criteria, evaluate the criteria.
- * A null value for criteria is considered to be always true.
- * @param criteria
- * @return true if the criteria always evaluate to true (e.g. 1 = 1); false otherwise.
- * @throws TeiidComponentException
- * @throws BlockedException
- * @throws TeiidComponentException
- * @throws ExpressionEvaluationException
- * @since 4.2
- */
- private static boolean evaluateCriteria(Criteria criteria) throws TeiidComponentException, ExpressionEvaluationException {
- if(criteria == null) {
- return true;
- }
- return Evaluator.evaluate(criteria);
- }
-
- /**
* Decides whether a command needs to be executed.
* <br/><b>NOTE: This method has a side-effect.</b> If the criteria of this command always evaluate to true,
* and the simplifyCriteria flag is true, then the command criteria are set to null.
* @param command
- * @param simplifyCriteria wheter to simplify the criteria of the command if they always evaluate to true
+ * @param simplifyCriteria whether to simplify the criteria of the command if they always evaluate to true
* @return true if this command should be executed by the connector; false otherwise.
* @throws TeiidComponentException
* @throws ExpressionEvaluationException
@@ -89,7 +70,7 @@
if (limit != null && limit.getRowLimit() instanceof Constant) {
Constant rowLimit = (Constant)limit.getRowLimit();
- if (new Integer(0).equals(rowLimit.getValue())) {
+ if (Integer.valueOf(0) == rowLimit.getValue()) {
return false;
}
}
@@ -117,7 +98,7 @@
// If there are elements present in the criteria,
// then we don't know the result, so assume we need to execute
return true;
- } else if(evaluateCriteria(criteria)) {
+ } else if(Evaluator.evaluate(criteria)) {
if (simplifyCriteria) {
query.setCriteria(null);
}
@@ -146,7 +127,7 @@
}
if(!EvaluatableVisitor.isFullyEvaluatable(criteria, false)) {
return true;
- } else if(evaluateCriteria(criteria)) {
+ } else if(Evaluator.evaluate(criteria)) {
if (simplifyCriteria) {
update.setCriteria(null);
}
@@ -163,7 +144,7 @@
}
if(!EvaluatableVisitor.isFullyEvaluatable(criteria, false)) {
return true;
- } else if(evaluateCriteria(criteria)) {
+ } else if(Evaluator.evaluate(criteria)) {
if (simplifyCriteria) {
delete.setCriteria(null);
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -134,13 +134,13 @@
Create create = new Create();
create.setElementSymbolsAsColumns(withCommand.getColumns());
create.setTable(withCommand.getGroupSymbol());
- this.root.getDataManager().registerRequest(getContext(), create, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0);
+ this.root.getDataManager().registerRequest(getContext(), create, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
}
while (true) {
TupleBatch batch = withProcessor.nextBatch();
Insert insert = new Insert(withCommand.getGroupSymbol(), withCommand.getColumns(), null);
insert.setTupleSource(new CollectionTupleSource(batch.getTuples().iterator()));
- this.root.getDataManager().registerRequest(getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0);
+ this.root.getDataManager().registerRequest(getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
if (batch.getTerminationFlag()) {
break;
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -162,7 +162,7 @@
CommandContext context,
Command command,
String modelName,
- String connectorBindingId, int nodeID)
+ String connectorBindingId, int nodeID, int limit)
throws TeiidComponentException, TeiidProcessingException {
TempTableStore tempTableStore = context.getTempTableStore();
@@ -172,7 +172,7 @@
return result;
}
}
- return this.processorDataManager.registerRequest(context, command, modelName, connectorBindingId, nodeID);
+ return this.processorDataManager.registerRequest(context, command, modelName, connectorBindingId, nodeID, -1);
}
TupleSource registerRequest(CommandContext context, String modelName, Command command) throws TeiidComponentException, TeiidProcessingException {
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 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -54,8 +54,10 @@
private DataTierTupleSource info;
private AutoGenDataService connectorManager = new AutoGenDataService();
private RequestWorkItem workItem;
+ private int limit = -1;
@Before public void setUp() {
+ limit = -1;
connectorManager = new AutoGenDataService();
}
@@ -103,7 +105,7 @@
request = new AtomicRequestMessage(original, workContext, nodeId);
request.setCommand(command);
request.setConnectorName("FakeConnectorID"); //$NON-NLS-1$
- info = new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm);
+ info = new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm, limit);
}
@Test public void testDataTierTupleSource() throws Exception {
@@ -122,6 +124,23 @@
assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
+ @Test public void testDataTierTupleSourceLimit() throws Exception {
+ limit = 1;
+ helpSetup(1);
+ for (int i = 0; i < 1;) {
+ try {
+ info.nextTuple();
+ i++;
+ } catch (BlockedException e) {
+ Thread.sleep(50);
+ }
+ }
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
+ assertNull(info.nextTuple());
+ info.closeSource();
+ assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
+ }
+
@Test public void testPartialResults() throws Exception {
helpSetup(1);
connectorManager.throwExceptionOnExecute = true;
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -70,7 +70,7 @@
setMustRegisterCommands(false);
}
- public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID) throws org.teiid.core.TeiidComponentException {
+ public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit) throws org.teiid.core.TeiidComponentException {
assertNotNull(connectorBindingId);
Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(command, true, true);
@@ -80,7 +80,7 @@
fail("Query Contains a MultiSourceElement -- MultiSource expansion did not happen"); //$NON-NLS-1$
}
}
- return super.registerRequest(context, command, modelName, connectorBindingId, nodeID);
+ return super.registerRequest(context, command, modelName, connectorBindingId, nodeID, limit);
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -108,7 +108,7 @@
// does nothing?
}
- public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID)
+ public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit)
throws TeiidComponentException {
LogManager.logTrace(LOG_CONTEXT, new Object[]{"Register Request:", command, ",processorID:", context.getProcessorID(), ",model name:", modelName,",TupleSourceID nodeID:",new Integer(nodeID)}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Modified: trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -117,13 +117,13 @@
}
/**
- * @see org.teiid.query.processor.ProcessorDataManager#registerRequest(CommandContext, org.teiid.query.sql.lang.Command, java.lang.String, String, int)
+ * @see org.teiid.query.processor.ProcessorDataManager#registerRequest(CommandContext, org.teiid.query.sql.lang.Command, java.lang.String, String, int, int)
* @since 4.2
*/
public TupleSource registerRequest(CommandContext context,
Command command,
String modelName,
- String connectorBindingId, int nodeID) throws TeiidComponentException {
+ String connectorBindingId, int nodeID, int limit) throws TeiidComponentException {
if(modelName != null && validModels != null && ! validModels.contains(modelName)) {
throw new TeiidComponentException("Detected query against invalid model: " + modelName + ": " + command); //$NON-NLS-1$//$NON-NLS-2$
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -726,7 +726,7 @@
@Override
public TupleSource registerRequest(CommandContext context,
Command command, String modelName,
- String connectorBindingId, int nodeID)
+ String connectorBindingId, int nodeID, int limit)
throws TeiidComponentException {
if (command instanceof StoredProcedure) {
StoredProcedure proc = (StoredProcedure)command;
@@ -738,7 +738,7 @@
});
}
return super.registerRequest(context, command, modelName,
- connectorBindingId, nodeID);
+ connectorBindingId, nodeID, limit);
}
};
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 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -211,7 +211,7 @@
this.numExecutedCommands = numExecutedCommands;
}
public Object lookupCodeValue(CommandContext context,String codeTableName,String returnElementName,String keyElementName,Object keyValue) throws BlockedException,TeiidComponentException {return null;}
- public TupleSource registerRequest(CommandContext context,Command command,String modelName,String connectorBindingId, int nodeID) throws TeiidComponentException {
+ public TupleSource registerRequest(CommandContext context,Command command,String modelName,String connectorBindingId, int nodeID, int limit) throws TeiidComponentException {
assertEquals("myProcessorID", context.getProcessorID()); //$NON-NLS-1$
assertEquals("myModelName", modelName); //$NON-NLS-1$
assertEquals(1, nodeID);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestLimitNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestLimitNode.java 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestLimitNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -22,23 +22,18 @@
package org.teiid.query.processor.relational;
+import static org.junit.Assert.*;
+
import java.util.Arrays;
import java.util.List;
+import org.junit.Test;
import org.teiid.common.buffer.TupleBatch;
-import org.teiid.query.processor.relational.LimitNode;
-import org.teiid.query.processor.relational.RelationalNode;
import org.teiid.query.sql.symbol.Constant;
-import junit.framework.TestCase;
-
-
-/**
- * @since 4.3
- */
-public class TestLimitNode extends TestCase {
+public class TestLimitNode {
- public void testLimitInFirstBatch() throws Exception {
+ @Test public void testLimitInFirstBatch() throws Exception {
LimitNode node = getLimitNode(40, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -49,7 +44,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testLimitAtBatchSize() throws Exception {
+ @Test public void testLimitAtBatchSize() throws Exception {
LimitNode node = getLimitNode(50, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -60,7 +55,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testLimitInSecondBatch() throws Exception {
+ @Test public void testLimitInSecondBatch() throws Exception {
LimitNode node = getLimitNode(55, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -77,7 +72,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testLimitMultipleOfBatchSize() throws Exception {
+ @Test public void testLimitMultipleOfBatchSize() throws Exception {
LimitNode node = getLimitNode(100, new FakeRelationalNode(2, getRows(150), 50));
TupleBatch batch = node.nextBatch();
@@ -94,7 +89,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testLimitProducesMultipleBatches() throws Exception {
+ @Test public void testLimitProducesMultipleBatches() throws Exception {
LimitNode node = getLimitNode(130, new FakeRelationalNode(2, getRows(300), 50));
TupleBatch batch = node.nextBatch();
@@ -119,7 +114,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testLimitGetsNoRows() throws Exception {
+ @Test public void testLimitGetsNoRows() throws Exception {
LimitNode node = getLimitNode(100, new FakeRelationalNode(2, getRows(0), 50));
TupleBatch batch = node.nextBatch();
@@ -128,7 +123,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testZeroLimit() throws Exception {
+ @Test public void testZeroLimit() throws Exception {
LimitNode node = getLimitNode(0, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -141,7 +136,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetInFirstBatch() throws Exception {
+ @Test public void testOffsetInFirstBatch() throws Exception {
LimitNode node = getOffsetNode(49, new FakeRelationalNode(2, getRows(100), 50));
// batch 1
TupleBatch batch = node.nextBatch();
@@ -161,7 +156,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetAtBatchSize() throws Exception {
+ @Test public void testOffsetAtBatchSize() throws Exception {
LimitNode node = getOffsetNode(50, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -173,7 +168,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetInSecondBatch() throws Exception {
+ @Test public void testOffsetInSecondBatch() throws Exception {
LimitNode node = getOffsetNode(55, new FakeRelationalNode(2, getRows(100), 50));
// batch 1
TupleBatch batch = node.nextBatch();
@@ -185,7 +180,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetMultipleOfBatchSize() throws Exception {
+ @Test public void testOffsetMultipleOfBatchSize() throws Exception {
LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(300), 50));
TupleBatch batch = node.nextBatch();
@@ -197,7 +192,7 @@
assertFalse(batch.getTerminationFlag());
}
- public void testOffsetGreaterThanRowCount() throws Exception {
+ @Test public void testOffsetGreaterThanRowCount() throws Exception {
LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(10), 50));
TupleBatch batch = node.nextBatch();
@@ -206,7 +201,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetNoRows() throws Exception {
+ @Test public void testOffsetNoRows() throws Exception {
LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(0), 50));
TupleBatch batch = node.nextBatch();
@@ -215,7 +210,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testZeroOffset() throws Exception {
+ @Test public void testZeroOffset() throws Exception {
LimitNode node = getOffsetNode(0, new FakeRelationalNode(2, getRows(100), 50));
TupleBatch batch = node.nextBatch();
@@ -233,7 +228,7 @@
assertTrue(batch.getTerminationFlag());
}
- public void testOffsetWithoutLimit() throws Exception {
+ @Test public void testOffsetWithoutLimit() throws Exception {
LimitNode node = new LimitNode(1, null, new Constant(new Integer(10)));
node.addChild(new FakeRelationalNode(2, getRows(10), 50));
node.open();
@@ -266,7 +261,7 @@
return node;
}
- public void testClone() {
+ @Test public void testClone() {
LimitNode node = new LimitNode(1, new Constant(new Integer(-1)), null);
LimitNode clone = (LimitNode)node.clone();
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 2011-03-04 02:34:26 UTC (rev 2963)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2011-03-04 17:08:11 UTC (rev 2964)
@@ -132,7 +132,7 @@
this.expectedBatchSize = expectedBatchSize;
}
public Object lookupCodeValue(CommandContext context,String codeTableName,String returnElementName,String keyElementName,Object keyValue) throws BlockedException,TeiidComponentException {return null;}
- public TupleSource registerRequest(CommandContext context,Command command,String modelName,String connectorBindingId, int nodeID) throws TeiidComponentException, TeiidProcessingException {
+ public TupleSource registerRequest(CommandContext context,Command command,String modelName,String connectorBindingId, int nodeID, int limit) throws TeiidComponentException, TeiidProcessingException {
callCount++;
int batchSize = 1;
More information about the teiid-commits
mailing list