Author: rareddy
Date: 2010-10-21 14:43:02 -0400 (Thu, 21 Oct 2010)
New Revision: 2671
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java
trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
Log:
TEIID-1313: avoid the duplicate row the batch boundaries with nested table join
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java 2010-10-21
18:18:56 UTC (rev 2670)
+++
trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java 2010-10-21
18:43:02 UTC (rev 2671)
@@ -126,12 +126,14 @@
List<?> outputTuple = outputTuple(this.leftSource.getCurrentTuple(),
this.rightSource.getCurrentTuple());
- if (this.joinNode.matchesCriteria(outputTuple)) {
- joinNode.addBatchRow(outputTuple);
- outerMatched = true;
- }
+ boolean matches = this.joinNode.matchesCriteria(outputTuple);
rightSource.saveNext();
+
+ if (matches) {
+ outerMatched = true;
+ joinNode.addBatchRow(outputTuple);
+ }
}
if (!outerMatched && this.joinNode.getJoinType() == JoinType.JOIN_LEFT_OUTER)
{
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2010-10-21
18:18:56 UTC (rev 2670)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2010-10-21
18:43:02 UTC (rev 2671)
@@ -198,7 +198,19 @@
process(sql, expected);
}
- public static void process(String sql, List[] expectedResults) throws Exception {
+ @Test public void testTextTableMultiBatch() throws Exception {
+ String sql = "select x.* from (select * from pm1.g1 where e1 = 'c') y,
texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string) x";
+
+ List[] expected = new List[] {
+ Arrays.asList("c"),
+ Arrays.asList("1"),
+ Arrays.asList("true"),
+ };
+
+ process(sql, expected);
+ }
+
+ public static void process(String sql, List[] expectedResults) throws Exception {
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
ProcessorPlan plan = helpGetPlan(helpParse(sql),
FakeMetadataFactory.example1Cached());
Show replies by date