From: <jer...@us...> - 2014-05-09 17:44:13
|
Revision: 8253 http://sourceforge.net/p/bigdata/code/8253 Author: jeremy_carroll Date: 2014-05-09 17:44:11 +0000 (Fri, 09 May 2014) Log Message: ----------- Fix to trac 874 - JoinFilter placement and Unions Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis_CanJoin.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis.java 2014-05-09 17:44:02 UTC (rev 8252) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis.java 2014-05-09 17:44:11 UTC (rev 8253) @@ -1081,7 +1081,7 @@ */ // MUST : JOIN GROUP - private Set<IVariable<?>> getDefinitelyProducedBindings( + Set<IVariable<?>> getDefinitelyProducedBindings( final JoinGroupNode node, final Set<IVariable<?>> vars, final boolean recursive) { // Note: always report what is bound when we enter a group. The caller Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis_CanJoin.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis_CanJoin.java 2014-05-09 17:44:02 UTC (rev 8252) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/StaticAnalysis_CanJoin.java 2014-05-09 17:44:11 UTC (rev 8253) @@ -51,7 +51,7 @@ * @version $Id: StaticAnalysis_CanJoin.java 5378 2011-10-20 20:37:08Z * thompsonbry $ */ -public class StaticAnalysis_CanJoin extends StaticAnalysisBase { +public abstract class StaticAnalysis_CanJoin extends StaticAnalysisBase { private static final Logger log = Logger.getLogger(StaticAnalysis.class); @@ -392,12 +392,16 @@ // the constraints for the current predicate in the join path. final List<FilterNode> constraints = new LinkedList<FilterNode>(); - /* - * Visit the variables used by the predicate (and bound by it since - * it is not an optional predicate) and add them into the total set - * of variables which are bound at this point in the join path. - */ - getSpannedVariables((BOp) p, boundVars); + +// /* +// * Visit the variables used by the predicate (and bound by it since +// * it is not an optional predicate) and add them into the total set +// * of variables which are bound at this point in the join path. +// */ +// getSpannedVariables((BOp) p, boundVars); + // above does not work if p is a Union nor, I suspect, a Minus - jjc + // tring this next line as an alternative - jjc. + getDefinitelyProducedBindings(p, boundVars, true); if (joinGraphConstraints != null) { @@ -479,5 +483,43 @@ return ret; } + + /** + * Return the set of variables which MUST be bound for solutions after the + * evaluation of this group. A group will produce "MUST" bindings for + * variables from its statement patterns and a LET based on an expression + * whose variables are known bound. + * <p> + * The returned collection reflects "bottom-up" evaluation semantics. This + * method does NOT consider variables which are already bound on entry to + * the group. + * <p> + * Note: When invoked for an OPTIONAL or MINUS join group, the variables + * which would become bound during the evaluation of the join group are + * reported. Caller's who wish to NOT have variables reported for OPTIONAL + * or MINUS groups MUST NOT invoke this method for those groups. + * <p> + * Note: The recursive analysis does not throw out variables when part of + * the tree will provably fail to bind anything. It is the role of query + * optimizers to identify those situations and prune the AST appropriately. + * <p> + * The class hierarchy is a little untidy at this point. + * This method is defined in the only subclass of this abstract class. + * Initially it was thought to not be needed here. + * + * @param node + * The node to be analyzed. + * @param vars + * Where to store the "MUST" bound variables. + * @param recursive + * When <code>true</code>, the child groups will be recursively + * analyzed. When <code>false</code>, only <i>this</i> group will + * be analyzed. + * + * @return The argument. + */ + public abstract Set<IVariable<?>> getDefinitelyProducedBindings( + final IBindingProducerNode node, final Set<IVariable<?>> vars, + final boolean recursive); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |