jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject jena git commit: Don't merge extends when looking for inlining oppurtunities (JENA-780)
Date Tue, 07 Jul 2015 12:54:41 GMT
Repository: jena
Updated Branches:
  refs/heads/master 2dc063f3b -> d0d7664ae


Don't merge extends when looking for inlining oppurtunities (JENA-780)

In checking the new optimization it was noticed that this introduces a
regression in the query JENA-779 that originally spawned this proposal.
This was because we used OpExtend.extend() rather than OpExtend.create()
which could result in other optimizations being blocked.

We now use OpExtend.create() instead and add a test to check that we
don't merge extends.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/d0d7664a
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/d0d7664a
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/d0d7664a

Branch: refs/heads/master
Commit: d0d7664aef51a8e88e5001ab0492688463374ebe
Parents: 2dc063f
Author: Rob Vesse <rvesse@apache.org>
Authored: Tue Jul 7 13:22:07 2015 +0100
Committer: Rob Vesse <rvesse@apache.org>
Committed: Tue Jul 7 13:53:50 2015 +0100

----------------------------------------------------------------------
 .../algebra/optimize/TransformEliminateAssignments.java |  2 +-
 .../algebra/optimize/TransformRemoveAssignment.java     |  4 ++--
 .../optimize/TestTransformEliminateAssignments.java     | 12 ++++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/d0d7664a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformEliminateAssignments.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformEliminateAssignments.java
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformEliminateAssignments.java
index 89dfc87..77ba124 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformEliminateAssignments.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformEliminateAssignments.java
@@ -257,7 +257,7 @@ public class TransformEliminateAssignments extends TransformCopy {
 
         // May be able to eliminate the extend entirely in some cases
         if (newAssignments.size() > 0) {
-            return OpExtend.extend(subOp, newAssignments);
+            return OpExtend.create(subOp, newAssignments);
         } else {
             return subOp;
         }

http://git-wip-us.apache.org/repos/asf/jena/blob/d0d7664a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformRemoveAssignment.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformRemoveAssignment.java
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformRemoveAssignment.java
index 6379d5b..564d3b3 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformRemoveAssignment.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformRemoveAssignment.java
@@ -99,14 +99,14 @@ public class TransformRemoveAssignment extends TransformCopy {
             // If topmost only ignore any transformations lower down the tree
             // hence call getSubOp() rather than using the provided subOp
             if (assignments.size() > 0) {
-                return OpExtend.extend(opExtend.getSubOp(), assignments);
+                return OpExtend.create(opExtend.getSubOp(), assignments);
             } else {
                 return opExtend.getSubOp();
             }
         } else {
             // Otherwise preserve any transformations from lower down the tree
             if (assignments.size() > 0) {
-                return OpExtend.extend(subOp, assignments);
+                return OpExtend.create(subOp, assignments);
             } else {
                 return subOp;
             }

http://git-wip-us.apache.org/repos/asf/jena/blob/d0d7664a/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformEliminateAssignments.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformEliminateAssignments.java
b/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformEliminateAssignments.java
index 1304fe4..117bd32 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformEliminateAssignments.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformEliminateAssignments.java
@@ -380,6 +380,18 @@ public class TestTransformEliminateAssignments {
                      "      (bgp (triple ?x ?y ?z)))))");
         //@formatter:on
     }
+    
+    @Test
+    public void no_merge_01() {
+        // We should not merge extends
+        //@formatter:off
+        testNoChange("(project (?x ?y)",
+                     "  (filter (exprlist ?x)",
+                     "    (extend (?x true)",
+                     "      (extend (?y false)",
+                     "        (table unit)))))");
+        //@formatter:on
+    }
 
     @Test
     public void scope_01() {


Mime
View raw message