From: <jer...@us...> - 2013-10-02 17:17:09
|
Revision: 7431 http://bigdata.svn.sourceforge.net/bigdata/?rev=7431&view=rev Author: jeremy_carroll Date: 2013-10-02 17:17:02 +0000 (Wed, 02 Oct 2013) Log Message: ----------- defensive code concerning typing Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/AssignmentNode.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/UnionNode.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/AssignmentNode.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/AssignmentNode.java 2013-10-02 01:44:18 UTC (rev 7430) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/AssignmentNode.java 2013-10-02 17:17:02 UTC (rev 7431) @@ -5,6 +5,7 @@ import com.bigdata.bop.BOp; import com.bigdata.bop.IValueExpression; import com.bigdata.bop.IVariable; +import com.bigdata.bop.ModifiableBOpBase; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility; @@ -48,6 +49,7 @@ public AssignmentNode(BOp[] args, Map<String, Object> anns) { super(args, anns); + assert args[0] instanceof VarNode; } @@ -148,4 +150,17 @@ return super.replaceAllWith(oldVal, newVal); } + + @Override + public ModifiableBOpBase setArgs(final BOp[] args) { + assert args[0] instanceof VarNode; + return super.setArgs(args); + } + + + @Override + public ModifiableBOpBase setArg(final int index, final BOp newArg) { + assert index != 0 || newArg instanceof VarNode; + return super.setArg(index, newArg); + } } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/UnionNode.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/UnionNode.java 2013-10-02 01:44:18 UTC (rev 7430) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/UnionNode.java 2013-10-02 17:17:02 UTC (rev 7431) @@ -37,10 +37,13 @@ public UnionNode(BOp[] args, Map<String, Object> anns) { super(args, anns); + for (BOp x:args) { + assert x instanceof JoinGroupNode; + } } -// /** + // /** // * Construct a non-optional union. // */ public UnionNode() { @@ -111,5 +114,23 @@ return true; } - + + @Override + public void addArg(final BOp newArg) { + assert newArg instanceof JoinGroupNode; + super.addArg(newArg); + } + + @Override + public void addArg(final int index, final BOp newArg) { + assert newArg instanceof JoinGroupNode; + super.addArg(index, newArg); + + } + + @Override + public int replaceWith(final BOp oldChild, final BOp newChild) { + assert newChild instanceof JoinGroupNode; + return super.replaceWith(oldChild, newChild); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-13 14:31:45
|
Revision: 7778 http://bigdata.svn.sourceforge.net/bigdata/?rev=7778&view=rev Author: thompsonbry Date: 2014-01-13 14:31:38 +0000 (Mon, 13 Jan 2014) Log Message: ----------- @Override, final, suppress rawtypes warnings. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ComputedMaterializationRequirement.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/GroupMemberValueExpressionNodeBase.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ComputedMaterializationRequirement.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ComputedMaterializationRequirement.java 2014-01-13 14:30:08 UTC (rev 7777) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ComputedMaterializationRequirement.java 2014-01-13 14:31:38 UTC (rev 7778) @@ -46,6 +46,7 @@ * @version $Id: ComputedMaterializationRequirement.java 5179 2011-09-12 * 20:13:25Z thompsonbry $ */ +@SuppressWarnings("rawtypes") public class ComputedMaterializationRequirement implements INeedsMaterialization, Serializable { @@ -58,6 +59,7 @@ private final Set<IVariable<IV>> varsToMaterialize; + @Override public String toString() { return "{requirement=" + requirement + ", vars=" + Arrays.toString(varsToMaterialize.toArray()) @@ -81,6 +83,7 @@ } + @Override public Requirement getRequirement() { return requirement; @@ -93,6 +96,7 @@ } + @Override public boolean equals(final Object o) { if (this == o) Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/GroupMemberValueExpressionNodeBase.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/GroupMemberValueExpressionNodeBase.java 2014-01-13 14:30:08 UTC (rev 7777) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/GroupMemberValueExpressionNodeBase.java 2014-01-13 14:31:38 UTC (rev 7778) @@ -37,12 +37,12 @@ import com.bigdata.bop.IValueExpression; import com.bigdata.bop.IVariable; import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.constraints.INeedsMaterialization; /** * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ +@SuppressWarnings("rawtypes") public abstract class GroupMemberValueExpressionNodeBase extends GroupMemberNodeBase implements IValueExpressionMetadata { @@ -97,6 +97,7 @@ } + @Override public Set<IVariable<?>> getConsumedVars() { final Set<IVariable<?>> consumedVars = new LinkedHashSet<IVariable<?>>(); @@ -114,6 +115,7 @@ } + @Override public ComputedMaterializationRequirement getMaterializationRequirement() { final IValueExpression<?> ve = getRequiredValueExpression(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 14:05:34
|
Revision: 7802 http://bigdata.svn.sourceforge.net/bigdata/?rev=7802&view=rev Author: thompsonbry Date: 2014-01-15 14:05:24 +0000 (Wed, 15 Jan 2014) Log Message: ----------- final and @Override annotations. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/SubqueryRoot.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTOptimizerList.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/SubqueryRoot.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/SubqueryRoot.java 2014-01-15 13:17:18 UTC (rev 7801) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/SubqueryRoot.java 2014-01-15 14:05:24 UTC (rev 7802) @@ -138,6 +138,7 @@ /** * Returns <code>false</code>. */ + @Override final public boolean isOptional() { return false; @@ -147,12 +148,14 @@ /** * Returns <code>false</code>. */ + @Override final public boolean isMinus() { return false; } - + + @Override final public List<FilterNode> getAttachedJoinFilters() { @SuppressWarnings("unchecked") @@ -168,6 +171,7 @@ } + @Override final public void setAttachedJoinFilters(final List<FilterNode> filters) { setProperty(Annotations.FILTERS, filters); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTOptimizerList.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTOptimizerList.java 2014-01-15 13:17:18 UTC (rev 7801) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTOptimizerList.java 2014-01-15 14:05:24 UTC (rev 7802) @@ -55,12 +55,19 @@ */ private static final long serialVersionUID = 1L; - public ASTOptimizerList(Collection<IASTOptimizer> c) { - super(c); + public ASTOptimizerList(final Collection<IASTOptimizer> c) { + + super(c); + } - public ASTOptimizerList(IASTOptimizer ... optimizers) { - this(Arrays.asList(optimizers)); + + public ASTOptimizerList(final IASTOptimizer... optimizers) { + + this(Arrays.asList(optimizers)); + } + + @Override public boolean add(final IASTOptimizer opt) { if(opt == null) @@ -79,6 +86,7 @@ * Note: This makes a deep copy of the AST before applying destructive * modifications. */ + @Override public IQueryNode optimize(final AST2BOpContext context, IQueryNode queryNode, final IBindingSet[] bindingSets) { @@ -95,7 +103,8 @@ queryNode = opt.optimize(context, queryNode, bindingSets); - assert queryNode != null : "Optimized discarded query: " + opt; + if (queryNode == null) + throw new AssertionError("Optimized discarded query: " + opt); if (log.isDebugEnabled()) log.debug("Rewritten AST:\n" + queryNode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-02-20 12:13:09
|
Revision: 7857 http://sourceforge.net/p/bigdata/code/7857 Author: thompsonbry Date: 2014-02-20 12:13:07 +0000 (Thu, 20 Feb 2014) Log Message: ----------- Removed the use of some jetty classes. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeBindingsCollector.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeCacheUpdater.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTEvalHelper.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeBindingsCollector.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeBindingsCollector.java 2014-02-20 12:02:54 UTC (rev 7856) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeBindingsCollector.java 2014-02-20 12:13:07 UTC (rev 7857) @@ -31,7 +31,6 @@ import java.util.Set; import org.apache.log4j.Logger; -import org.eclipse.jetty.util.ConcurrentHashSet; import org.openrdf.query.Binding; import org.openrdf.query.BindingSet; import org.openrdf.query.QueryEvaluationException; @@ -51,7 +50,7 @@ .getLogger(DescribeBindingsCollector.class); private final IVariable<?>[] originalVars; - private final ConcurrentHashSet<BigdataValue> describedResources; + private final Set<BigdataValue> describedResources; private final CloseableIteration<BindingSet, QueryEvaluationException> src; private boolean open = true; @@ -61,12 +60,13 @@ * The set of variables whose distinct bound values will be * reported. * @param describedResources - * The set of distinct bound values for those variables. + * The set of distinct bound values for those variables (a high + * concurrency, thread-safe set). * @param src * The source iterator. */ public DescribeBindingsCollector(final Set<IVariable<?>> originalVars, - final ConcurrentHashSet<BigdataValue> describedResources, + final Set<BigdataValue> describedResources, final CloseableIteration<BindingSet, QueryEvaluationException> src) { if (originalVars == null) Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeCacheUpdater.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeCacheUpdater.java 2014-02-20 12:02:54 UTC (rev 7856) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/cache/DescribeCacheUpdater.java 2014-02-20 12:13:07 UTC (rev 7857) @@ -4,9 +4,9 @@ import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.apache.log4j.Logger; -import org.eclipse.jetty.util.ConcurrentHashSet; import org.openrdf.model.Graph; import org.openrdf.model.Resource; import org.openrdf.model.Value; @@ -45,12 +45,12 @@ * original DESCRIBE query. We will collect all statements having a * described resource as either a subject or an object. * <p> - * Note: This set is populated as the solutions are observed before they - * are fed into the {@link ASTConstructIterator}. It is a - * {@link ConcurrentHashSet} in order to ensure the visibility of the - * updates to this class. + * Note: This set is populated as the solutions are observed before they are + * fed into the {@link ASTConstructIterator}. It MUST be a thread-safe + * {@link Set} in order to ensure the visibility of the updates to this + * class. It should also support high concurrency. */ - private final ConcurrentHashSet<BigdataValue> describedResources; + private final Set<BigdataValue> describedResources; /** * The source iterator visiting the statements that are the description @@ -78,10 +78,11 @@ * @param cache * The cache to be updated. * @param describedResources - * The {@link BigdataValue}s that become bound for the - * projection of the original DESCRIBE query. We will collect - * all statements having a described resource as either a - * subject or an object. + * The {@link BigdataValue}s that become bound for the projection + * of the original DESCRIBE query. We will collect all statements + * having a described resource as either a subject or an object. + * This MUST be a thread-safe (and concurrency favorable) set in + * order to ensure the visibility of the updates. * @param src * The source iterator, visiting the statements that are the * description of the resource(s) identified in the @@ -89,7 +90,7 @@ */ public DescribeCacheUpdater( final IDescribeCache cache, - final ConcurrentHashSet<BigdataValue> describedResources, + final Set<BigdataValue> describedResources, final CloseableIteration<BigdataStatement, QueryEvaluationException> src) { if (cache == null) Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTEvalHelper.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTEvalHelper.java 2014-02-20 12:02:54 UTC (rev 7856) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTEvalHelper.java 2014-02-20 12:13:07 UTC (rev 7857) @@ -36,10 +36,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; import org.apache.log4j.Logger; import org.apache.log4j.MDC; -import org.eclipse.jetty.util.ConcurrentHashSet; import org.openrdf.model.Value; import org.openrdf.query.Binding; import org.openrdf.query.BindingSet; @@ -513,7 +513,7 @@ try { final CloseableIteration<BindingSet, QueryEvaluationException> solutions2; - final ConcurrentHashSet<BigdataValue> describedResources; + final Set<BigdataValue> describedResources; if (describeCache != null) { /** @@ -540,7 +540,7 @@ */ // Concurrency safe set. - describedResources = new ConcurrentHashSet<BigdataValue>(); + describedResources = new ConcurrentSkipListSet<BigdataValue>(); // Collect the bindings on those variables. solutions2 = new DescribeBindingsCollector(// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |