jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1588811 - in /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine: TableJoin.java iterator/QueryIteratorCheck.java main/iterator/QueryIterJoinBase.java ref/EvaluatorSimple.java
Date Sun, 20 Apr 2014 18:02:27 GMT
Author: andy
Date: Sun Apr 20 18:02:27 2014
New Revision: 1588811

URL: http://svn.apache.org/r1588811
Log:
Close iterators explicitly and properly

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/TableJoin.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIteratorCheck.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterJoinBase.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/ref/EvaluatorSimple.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/TableJoin.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/TableJoin.java?rev=1588811&r1=1588810&r2=1588811&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/TableJoin.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/TableJoin.java Sun Apr
20 18:02:27 2014
@@ -35,7 +35,7 @@ import com.hp.hpl.jena.sparql.engine.ite
 import com.hp.hpl.jena.sparql.expr.Expr ;
 import com.hp.hpl.jena.sparql.expr.ExprList ;
 
-/** Table join - this only haoppens if the patterns can not be streamed. */  
+/** Table join - this only happens if the patterns can not be streamed. */  
 public class TableJoin
 {
     public static QueryIterator join(QueryIterator left, Table right, ExprList condition,
ExecutionContext execCxt) {
@@ -48,9 +48,11 @@ public class TableJoin
 
     public static QueryIterator joinWorker(QueryIterator left, Table right, JoinType joinType,
ExprList conditions, ExecutionContext execCxt) {
         if ( right.isEmpty() ) {
-            if ( joinType == PLAIN )
+            if ( joinType == PLAIN ) {
                 // No rows - no match
+                left.close() ;
                 return QueryIterNullIterator.create(execCxt) ;
+            }
             else
                 return left ;
         }

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIteratorCheck.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIteratorCheck.java?rev=1588811&r1=1588810&r2=1588811&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIteratorCheck.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIteratorCheck.java
Sun Apr 20 18:02:27 2014
@@ -86,7 +86,6 @@ public class QueryIteratorCheck extends 
             warn(qIterOpen, "Open iterator: ") ;
             iterOpen.remove() ;
         }
-     
     }
 
     private static void warn(QueryIterator qIter, String str)

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterJoinBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterJoinBase.java?rev=1588811&r1=1588810&r2=1588811&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterJoinBase.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterJoinBase.java
Sun Apr 20 18:02:27 2014
@@ -37,14 +37,14 @@ public class QueryIterJoinBase extends Q
     // This should be converted to a hash or sort-merge join.
     private final QueryIterator left ;
     private final QueryIterator right ;
-    private final QueryIter result ;
+    private final QueryIterator result ;
     
     protected QueryIterJoinBase(QueryIterator left, QueryIterator right, JoinType joinType,
ExprList exprs, ExecutionContext execCxt)
     {
         super(execCxt) ;
         this.left = left ;
         this.right = right ;
-        this.result = (QueryIter)calc(left, right, joinType, exprs, execCxt) ; 
+        this.result = calc(left, right, joinType, exprs, execCxt) ; 
     }
 
     private static QueryIterator calc(QueryIterator left, QueryIterator right, JoinType joinType,
ExprList exprs, ExecutionContext execCxt) {

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/ref/EvaluatorSimple.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/ref/EvaluatorSimple.java?rev=1588811&r1=1588810&r2=1588811&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/ref/EvaluatorSimple.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/ref/EvaluatorSimple.java
Sun Apr 20 18:02:27 2014
@@ -270,15 +270,12 @@ public class EvaluatorSimple implements 
 
     private Table joinWorker(Table tableLeft, Table tableRight, boolean leftJoin, ExprList
conditions)
     {
-        // Conditional LeftJoin is (left, Filter(expr, Join(left, right)))
-        // This is done in matchRightLeft
-    
-        // Have an iterator that yields one-by-one.
         QueryIterator left = tableLeft.iterator(execCxt) ;
         JoinType joinType = (leftJoin? JoinType.LEFT : JoinType.PLAIN ) ;
         QueryIterator qIter = TableJoin.joinWorker(left, tableRight, joinType, conditions,
execCxt) ;
         tableLeft.close() ;
         tableRight.close() ;
+        // qIter and left should be properly closed by use or called code. 
         return new TableN(qIter) ;
     }
     



Mime
View raw message