[teiid-commits] teiid SVN: r3143 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue May 3 17:08:28 EDT 2011


Author: shawkins
Date: 2011-05-03 17:08:27 -0400 (Tue, 03 May 2011)
New Revision: 3143

Modified:
   trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
Log:
TEIID-1576 fix for incorrect results with enhanced sort merge join

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-05-03 16:48:28 UTC (rev 3142)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-05-03 21:08:27 UTC (rev 3143)
@@ -293,10 +293,10 @@
 			List outputTuple = outputTuple(this.processingSortLeft==SortOption.NOT_SORTED?partitionedTuple:reorderedTuple, 
 					this.processingSortLeft==SortOption.NOT_SORTED?reorderedTuple:partitionedTuple);
 			boolean matches = this.joinNode.matchesCriteria(outputTuple);
+	        this.sortedTuple = null;
 	        if (matches) {
 	        	this.joinNode.addBatchRow(outputTuple);
 	        }
-	        this.sortedTuple = null;
     	}
     }
     

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-05-03 16:48:28 UTC (rev 3142)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-05-03 21:08:27 UTC (rev 3143)
@@ -223,17 +223,21 @@
     }
         
     public static void doProcess(ProcessorPlan plan, ProcessorDataManager dataManager, List[] expectedResults, CommandContext context) throws Exception {
-        BufferManagerImpl bufferMgr = BufferManagerFactory.createBufferManager();
-        bufferMgr.setProcessorBatchSize(context.getProcessorBatchSize());
-        bufferMgr.setConnectorBatchSize(context.getProcessorBatchSize());
-        context.getNextRand(0);
+    	BufferManager bufferMgr = context.getBufferManager();
+    	if (bufferMgr == null) {
+	        BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
+	        bm.setProcessorBatchSize(context.getProcessorBatchSize());
+	        bm.setConnectorBatchSize(context.getProcessorBatchSize());
+	        context.setBufferManager(bm);
+	        bufferMgr = bm;
+    	}
+    	context.getNextRand(0);
         if (context.getTempTableStore() == null) {
         	context.setTempTableStore(new TempTableStore(context.getConnectionID()));
         }
         if (context.getGlobalTableStore() == null) {
         	context.setGlobalTableStore(new TempTableStore("SYSTEM"));
         }
-        context.setBufferManager(bufferMgr);
         if (!(dataManager instanceof TempTableDataManager)) {
     	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
     	    cache.setBufferManager(bufferMgr);

Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java	2011-05-03 16:48:28 UTC (rev 3142)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java	2011-05-03 21:08:27 UTC (rev 3143)
@@ -599,7 +599,12 @@
     }
     
     @Test public void testMergeJoinOptimization() throws Exception {
-        this.joinType = JoinType.JOIN_INNER;
+        helpTestEnhancedSortMergeJoin(100);
+    }
+
+	private void helpTestEnhancedSortMergeJoin(int batchSize)
+			throws TeiidComponentException, TeiidProcessingException {
+		this.joinType = JoinType.JOIN_INNER;
         int rows = 100;
         List[] data = new List[rows];
         for(int i=0; i<rows; i++) { 
@@ -632,7 +637,11 @@
         helpCreateJoin();               
         this.joinStrategy = new EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT);
         this.join.setJoinStrategy(joinStrategy);
-        helpTestJoinDirect(expected, 100, 1);
+        helpTestJoinDirect(expected, batchSize, 1);
+	}
+    
+    @Test public void testMergeJoinOptimizationMultiBatch() throws Exception {
+    	helpTestEnhancedSortMergeJoin(10);
     }
     
     @Test public void testMergeJoinOptimizationNoRows() throws Exception {



More information about the teiid-commits mailing list