Author: jolee
Date: 2013-10-09 11:43:19 -0400 (Wed, 09 Oct 2013)
New Revision: 4602
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
Log:
TEIID-2690: Tuples lost in a with clause item
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2013-10-08
19:41:59 UTC (rev 4601)
+++
branches/7.7.x/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2013-10-09
15:43:19 UTC (rev 4602)
@@ -87,7 +87,7 @@
QueryProcessor queryProcessor;
List<ElementSymbol> columns;
BatchIterator iterator;
-
+
public TableProcessor(QueryProcessor queryProcessor,
List<ElementSymbol> columns) {
this.queryProcessor = queryProcessor;
@@ -361,7 +361,7 @@
TableProcessor withProcessor, TempTable tempTable)
throws TeiidComponentException, ExpressionEvaluationException,
TeiidProcessingException {
- tempTable.insert(new
BatchCollector.BatchProducerTupleSource(withProcessor.queryProcessor),
withProcessor.columns, false);
+ tempTable.insert(withProcessor.iterator, withProcessor.columns, false);
tempTable.setUpdatable(false);
processors.remove(tempTableID);
}
Modified:
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
===================================================================
---
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java 2013-10-08
19:41:59 UTC (rev 4601)
+++
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java 2013-10-09
15:43:19 UTC (rev 4602)
@@ -199,33 +199,32 @@
//check the full pushdown command
helpProcess(plan, dataManager, new List[0]);
}
-
-
+
@Test public void testWithBlockingJoin() throws TeiidException {
-
- String sql = "with a (x, y) as (select e1, e2 from pm1.g1) SELECT a.x, a.y,
pm1.g2.e1 from a left outer join pm1.g2 makenotdep on (rtrim(a.x) = pm1.g2.e1) order by
a.y"; //$NON-NLS-1$
-
- HardcodedDataManager dataManager = new HardcodedDataManager() {
- @Override
- public TupleSource registerRequest(CommandContext context,
+
+ String sql = "with a (x, y) as (select e1, e2 from pm1.g1) SELECT a.x, a.y,
pm1.g2.e1 from a left outer join pm1.g2 makenotdep on (rtrim(a.x) = pm1.g2.e1) order by
a.y"; //$NON-NLS-1$
+
+ HardcodedDataManager dataManager = new HardcodedDataManager() {
+ @Override
+ public TupleSource registerRequest(CommandContext context,
Command command,
String modelName,
String connectorBindingId, int nodeID, int limit)
- throws TeiidComponentException {
- final TupleSource ts = super.registerRequest(context, command, modelName, null,
0, 0);
- return new TupleSource() {
- int i = 0;
-
- @Override
- public List<?> nextTuple() throws TeiidComponentException,
- TeiidProcessingException {
- if ((i++ % 100)<3) {
- throw BlockedException.INSTANCE;
- }
- return ts.nextTuple();
- }
+ throws TeiidComponentException {
+ final TupleSource ts = super.registerRequest(context, command, modelName, null, 0,
0);
+ return new TupleSource() {
+ int i = 0;
@Override
+ public List<?> nextTuple() throws TeiidComponentException,
+ TeiidProcessingException {
+ if ((i++ % 100)<3) {
+ throw BlockedException.INSTANCE;
+ }
+ return ts.nextTuple();
+ }
+
+ @Override
public void closeSource() {
ts.closeSource();
}
@@ -237,7 +236,7 @@
rows[i] = Arrays.asList(String.valueOf(i));
}
dataManager.addData("SELECT g_0.e1 AS c_0 FROM pm1.g2 AS g_0 ORDER BY
c_0", rows);
- rows = new List[100];
+ rows = new List[2000];
for (int i = 0; i < rows.length; i++) {
rows[i] = Arrays.asList(String.valueOf(i), i);
}
@@ -247,12 +246,11 @@
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
RealMetadataFactory.example1Cached(), null, new
DefaultCapabilitiesFinder(TestOptimizer.getTypicalCapabilities()), new String[]
{"SELECT a.x, a.y FROM a", "SELECT g_0.e1 AS c_0 FROM pm1.g2 AS g_0 ORDER
BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING);
//check the full pushdown command
- List<?>[] result = new List[100];
+ List<?>[] result = new List[2000];
for (int i = 0; i < result.length; i++) {
result[i] = Arrays.asList(String.valueOf(i), i, i < 10?String.valueOf(i):null);
}
helpProcess(plan, dataManager, result);
}
-
}