From: <tho...@us...> - 2011-01-19 22:41:58
|
Revision: 4133 http://bigdata.svn.sourceforge.net/bigdata/?rev=4133&view=rev Author: thompsonbry Date: 2011-01-19 22:41:51 +0000 (Wed, 19 Jan 2011) Log Message: ----------- More work on the PartitionedJoinGroup utility and its test suite. Some javadoc and minor edits related to [1]. [1] https://sourceforge.net/apps/trac/bigdata/ticket/123 Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/PartitionedJoinGroup.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskBackedBufferStrategy.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestPartitionedJoinGroup.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/PartitionedJoinGroup.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/PartitionedJoinGroup.java 2011-01-19 21:22:01 UTC (rev 4132) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/PartitionedJoinGroup.java 2011-01-19 22:41:51 UTC (rev 4133) @@ -30,12 +30,6 @@ * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * - * @todo However, how do we manage when there are things like conditional - * routing operators? [Answer - the CONDITION is raised onto the subquery - * such that we only conditionally run the subquery rather than routing - * out of the subquery if the condition is not satisfied - MikeP is making - * this change.] - * * @todo The order of the {@link IPredicate}s in the tail plan is currently * unchanged from their given order (optional joins without constraints * can not reduce the selectivity of the query). However, it could be @@ -75,39 +69,26 @@ * The set of variables bound by the non-optional predicates. */ private final Set<IVariable<?>> joinGraphVars = new LinkedHashSet<IVariable<?>>(); - - /** - * An unordered list of constraints which do not involve ANY variables. - * These constraints should be run first, before the join graph. - * - * @todo integrate into evaluation. - */ - private final List<IConstraint> runFirstConstraints = new LinkedList<IConstraint>(); /** - * The set of the {@link IPredicate}s which have been flagged as - * "run first". These must all be non-optional predicates. They are usually - * special access paths created using an expander which replaces a mock - * access path. For example, free text search. + * The set of non-optional predicates which have been flagged as + * "run first". These are usually special access paths created using an + * expander which replaces a mock access path. For example, free text + * search. */ private final List<IPredicate<?>> headPlan = new LinkedList<IPredicate<?>>(); /** - * The set of constraints which can be evaluated with the head plan - * predicates because the variables appearing in those constraints are known - * to become bound within the head plan. - */ - private final List<IConstraint> headPlanConstraints = new LinkedList<IConstraint>(); - - /** * The set of non-optional predicates which represent the join graph. */ - private final List<IPredicate<?>> joinGraphPredicates = new LinkedList<IPredicate<?>>(); + private final List<IPredicate<?>> joinGraph = new LinkedList<IPredicate<?>>(); /** - * The set of constraints which can be evaluated with the join graph - * predicates because the variables appearing in those constraints are known - * to become bound within the join graph. + * The set of constraints which can be evaluated with the head plan and/or + * join graph predicates because the variables appearing in those + * constraints are known to become bound within the join graph. ( The + * {@link #headPlan} and the {@link #joinGraph} share the same + * pool of constraints.) */ private final List<IConstraint> joinGraphConstraints = new LinkedList<IConstraint>(); @@ -128,9 +109,10 @@ * The values are the sets of constraints to run for that tail. */ private final Map<Integer/* predId */, List<IConstraint>> tailPlanConstraintMap = new LinkedHashMap<Integer, List<IConstraint>>(); - + /** - * The set of variables bound by the non-optional predicates. + * The set of variables bound by the non-optional predicates (either the + * head plan or the join graph). */ public Set<IVariable<?>> getJoinGraphVars() { return joinGraphVars; @@ -139,9 +121,8 @@ /** * The {@link IPredicate}s in the join graph (required joins). */ - public IPredicate<?>[] getJoinGraphPredicates() { - return joinGraphPredicates.toArray(new IPredicate[joinGraphPredicates - .size()]); + public IPredicate<?>[] getJoinGraph() { + return joinGraph.toArray(new IPredicate[joinGraph.size()]); } /** @@ -275,7 +256,7 @@ headPlan.add(p); } else { // part of the join graph. - joinGraphPredicates.add(p); + joinGraph.add(p); } /* * Add to the set of variables which will be bound by the time @@ -300,12 +281,9 @@ .getSpannedVariables(c); if (!vitr.hasNext()) { /* - * This is a constraint which does not involve any variable so - * we should evaluate it as soon as possible. I.e., before the - * join graph. + * All constraints should have at least one variable. */ - runFirstConstraints.add(c); // @todo unit test. - continue; + throw new RuntimeException("No variables in constraint: " + c); } while (vitr.hasNext()) { final IVariable<?> var = vitr.next(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskBackedBufferStrategy.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskBackedBufferStrategy.java 2011-01-19 21:22:01 UTC (rev 4132) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskBackedBufferStrategy.java 2011-01-19 22:41:51 UTC (rev 4133) @@ -109,7 +109,7 @@ /** * Forces the data to disk. */ - public void force( boolean metadata ) { + public void force(final boolean metadata) { try { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java 2011-01-19 21:22:01 UTC (rev 4132) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java 2011-01-19 22:41:51 UTC (rev 4133) @@ -1363,10 +1363,10 @@ } /** - * {@link #flushWriteCache() flushs} the {@link #writeCache} before syncing + * {@link #flushWriteCache() flushes} the {@link #writeCache} before syncing * the disk. */ - public void force(boolean metadata) { + public void force(final boolean metadata) { assertOpen(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestPartitionedJoinGroup.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestPartitionedJoinGroup.java 2011-01-19 21:22:01 UTC (rev 4132) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestPartitionedJoinGroup.java 2011-01-19 22:41:51 UTC (rev 4133) @@ -194,11 +194,11 @@ // verify all predicates were placed into the join graph. assertSameIteratorAnyOrder("joinGraph", preds, Arrays.asList( - fixture.getJoinGraphPredicates()).iterator()); + fixture.getJoinGraph()).iterator()); // there are no constraints. - assertEquals("joinGraphConstraints.size", 0, fixture - .getJoinGraphConstraints().length); + assertEquals("joinGraphConstraints.size", new IConstraint[] {}, + fixture.getJoinGraphConstraints()); // there is no tail plan. assertEquals("tailPlan", new IPredicate[] {}, fixture.getTailPlan()); @@ -225,7 +225,7 @@ // verify all predicates were placed into the join graph. assertSameIteratorAnyOrder("joinGraph", preds, Arrays.asList( - fixture.getJoinGraphPredicates()).iterator()); + fixture.getJoinGraph()).iterator()); // verify all constraints were place on the join graph. assertSameIteratorAnyOrder("joinGraphConstraints", constraints, @@ -343,7 +343,7 @@ // verify predicates placed into the join graph. assertSameIteratorAnyOrder("joinGraph", new IPredicate[] { p0, p1, - p5 }, Arrays.asList(fixture.getJoinGraphPredicates()) + p5 }, Arrays.asList(fixture.getJoinGraph()) .iterator()); // there are no constraints on the join graph predicates. @@ -392,7 +392,7 @@ // verify predicates placed into the join graph. assertSameIteratorAnyOrder("joinGraph", new IPredicate[] { p0, p1, - p5 }, Arrays.asList(fixture.getJoinGraphPredicates()) + p5 }, Arrays.asList(fixture.getJoinGraph()) .iterator()); // verify constraints on the join graph. @@ -423,8 +423,6 @@ /** * @todo test with headPlan. * - * @todo test for runFirst constraints. - * * @todo test logic to attach constraints to non-optional joins based on a * given join path (not yet written). */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |