From: <tho...@us...> - 2013-12-31 19:48:20
|
Revision: 7711 http://bigdata.svn.sourceforge.net/bigdata/?rev=7711&view=rev Author: thompsonbry Date: 2013-12-31 19:48:13 +0000 (Tue, 31 Dec 2013) Log Message: ----------- Improved reporting in the Explain view. Override and final annotations. Refactored ChunkedMaterializationOp and DropOp to expose their VARS annotation through getVars() and to use that method rather than getProperty() when accessing the variables. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/solutions/DropOp.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java 2013-12-31 19:43:51 UTC (rev 7710) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java 2013-12-31 19:48:13 UTC (rev 7711) @@ -43,8 +43,9 @@ import com.bigdata.bop.BOpUtility; import com.bigdata.bop.IPredicate; import com.bigdata.bop.IQueryAttributes; -import com.bigdata.bop.IVariable; import com.bigdata.bop.IVariableOrConstant; +import com.bigdata.bop.PipelineOp; +import com.bigdata.bop.bset.ConditionalRoutingOp; import com.bigdata.bop.controller.INamedSolutionSetRef; import com.bigdata.bop.controller.NamedSetAnnotations; import com.bigdata.bop.engine.RunState.RunStateEnum; @@ -57,6 +58,8 @@ import com.bigdata.bop.joinGraph.rto.Path; import com.bigdata.bop.joinGraph.rto.PathIds; import com.bigdata.bop.rdf.join.ChunkedMaterializationOp; +import com.bigdata.bop.solutions.DropOp; +import com.bigdata.bop.solutions.GroupByOp; import com.bigdata.bop.solutions.ProjectionOp; import com.bigdata.counters.render.XHTMLRenderer; import com.bigdata.rawstore.Bytes; @@ -401,6 +404,16 @@ } else { sb.append(bop.getClass().getSimpleName()); sb.append("[" + bopId + "]"); + final Integer defaultSink = (Integer) bop + .getProperty(PipelineOp.Annotations.SINK_REF); + final Integer altSink = (Integer) bop + .getProperty(PipelineOp.Annotations.ALT_SINK_REF); + if (defaultSink != null) { + sb.append(", sink=" + defaultSink); + } + if (altSink != null) { + sb.append(", altSink=" + altSink); + } } sb.append('\t'); if (pred != null) { @@ -476,10 +489,41 @@ } } if (bop instanceof ChunkedMaterializationOp) { - final IVariable<?>[] vars = (IVariable<?>[]) bop - .getProperty(ChunkedMaterializationOp.Annotations.VARS); - sb.append(Arrays.toString(vars)); + sb.append(cdata("vars=" + + Arrays.toString(((ChunkedMaterializationOp) bop) + .getVars()) + ",materializeInlineIVs=" + + ((ChunkedMaterializationOp) bop).materializeInlineIVs())); } + if (bop instanceof GroupByOp) { + sb.append(cdata(((GroupByOp) bop).getGroupByState().toString())); + sb.append(cdata(" "));// whitespace to break the line. + sb.append(cdata(((GroupByOp) bop).getGroupByRewrite().toString())); + } + if (bop instanceof DropOp) { + sb.append(cdata(Arrays.toString(((DropOp)bop).getDropVars()))); + } + if (bop instanceof ConditionalRoutingOp) { + sb.append(cdata(((ConditionalRoutingOp) bop).getCondition() + .toString())); + } + if (bop instanceof JoinGraph) { + final JoinGraph t = ((JoinGraph) bop); +// final Path p = t.getPath(q); +// final Map<PathIds, EdgeSample> samples = t +// .getSamples(q); + sb.append(cdata("sampleType=" + t.getSampleType())); + sb.append(cdata(", limit=" + t.getLimit())); + sb.append(cdata(", nedges=" + t.getNEdges())); +// if (p != null && samples != null) { // Note: breaks table formatting. +// // Show the RTO discovered join path. +// w.write("<pre>"); +// w.write(cdata(JGraph.showPath(p, samples))); +// w.write("</pre>"); +// } + } + if (bop instanceof ProjectionOp) { + sb.append(cdata(Arrays.toString(((ProjectionOp) bop).getVariables()))); + } /* * Static optimizer metadata. @@ -1081,10 +1125,28 @@ } else { w.write(cdata(bop.getClass().getSimpleName())); w.write(cdata("[" + bopId + "]")); + final Integer defaultSink = (Integer) bop + .getProperty(PipelineOp.Annotations.SINK_REF); + final Integer altSink = (Integer) bop + .getProperty(PipelineOp.Annotations.ALT_SINK_REF); + if (defaultSink != null) { + w.write(cdata(", sink=" + defaultSink)); + } + if (altSink != null) { + w.write(cdata(", altSink=" + altSink)); + } } w.write(TDx); - // operator summary (not shown for the "total" line). + /* + * Pperator summary (not shown for the "total" line). + * + * TODO We should have self-reporting of the summary for each operator, + * potentially as XHTML. Also, the parser should pass along the SPARQL + * snip that corresponds to the operator so we can display it here. We + * already handle this for the SERVICE call's inner graph pattern. It + * could be handled in general. + */ w.write(TD); if(!summary) { if (pred != null) { @@ -1161,10 +1223,28 @@ } } if (bop instanceof ChunkedMaterializationOp) { - final IVariable<?>[] vars = (IVariable<?>[]) bop - .getProperty(ChunkedMaterializationOp.Annotations.VARS); - w.write(cdata(Arrays.toString(vars))); + w.write(cdata("vars=" + + Arrays.toString(((ChunkedMaterializationOp) bop) + .getVars()) + + ",materializeInlineIVs=" + + ((ChunkedMaterializationOp) bop) + .materializeInlineIVs())); } + if (bop instanceof GroupByOp) { + w.write(cdata(((GroupByOp) bop).getGroupByState().toString())); + if (detailedStats) { + w.write(cdata(" "));// whitespace to break the line. + w.write(cdata(((GroupByOp) bop).getGroupByRewrite() + .toString())); + } + } + if (bop instanceof DropOp) { + w.write(cdata(Arrays.toString(((DropOp) bop).getDropVars()))); + } + if (bop instanceof ConditionalRoutingOp) { + w.write(cdata(((ConditionalRoutingOp) bop).getCondition() + .toString())); + } if (bop instanceof JoinGraph) { final JoinGraph t = ((JoinGraph) bop); final Path p = t.getPath(q); @@ -1181,9 +1261,8 @@ } } if (bop instanceof ProjectionOp) { - final IVariable<?>[] vars = (IVariable<?>[]) bop - .getProperty(ProjectionOp.Annotations.SELECT); - w.write(cdata(Arrays.toString(vars))); + w.write(cdata(Arrays.toString(((ProjectionOp) bop) + .getVariables()))); } } w.write(TDx); // end summary Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/solutions/DropOp.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/solutions/DropOp.java 2013-12-31 19:43:51 UTC (rev 7710) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/solutions/DropOp.java 2013-12-31 19:48:13 UTC (rev 7711) @@ -61,7 +61,8 @@ /** * An {@link IVariable}[] identifying the variables to be DROPPED in the - * {@link IBindingSet}s written out by the operator. + * {@link IBindingSet}s written out by the operator (required, must be a + * non-empty array). */ String DROP_VARS = DropOp.class.getName() + ".dropVars"; @@ -78,35 +79,33 @@ * @param args * @param annotations */ - public DropOp(BOp[] args, Map<String, Object> annotations) { + public DropOp(final BOp[] args, final Map<String, Object> annotations) { super(args, annotations); - final IVariable<?>[] dropVars = (IVariable<?>[]) getRequiredProperty(Annotations.DROP_VARS); + final IVariable<?>[] dropVars = getDropVars(); - if (dropVars == null) - throw new IllegalArgumentException(); - if (dropVars.length == 0) throw new IllegalArgumentException(); } - public DropOp(final BOp[] args, NV... annotations) { + public DropOp(final BOp[] args, final NV... annotations) { this(args, NV.asMap(annotations)); } -// /** -// * @see Annotations#DROP -// */ -// public IVariable<?>[] getVariables() { -// -// return (IVariable<?>[]) getRequiredProperty(Annotations.DROP); -// -// } + /** + * @see Annotations#DROP_VARS + */ + public IVariable<?>[] getDropVars() { + return (IVariable<?>[]) getRequiredProperty(Annotations.DROP_VARS); + + } + + @Override public FutureTask<Void> eval(final BOpContext<IBindingSet> context) { return new FutureTask<Void>(new ChunkTask(this, context)); @@ -129,11 +128,11 @@ this.context = context; - this.vars = (IVariable<?>[]) op - .getRequiredProperty(Annotations.DROP_VARS); + this.vars = op.getDropVars(); } + @Override public Void call() throws Exception { final BOpStats stats = context.getStats(); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java 2013-12-31 19:43:51 UTC (rev 7710) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java 2013-12-31 19:48:13 UTC (rev 7711) @@ -102,11 +102,12 @@ * @param args * @param annotations */ - public ChunkedMaterializationOp(BOp[] args, Map<String, Object> annotations) { + public ChunkedMaterializationOp(final BOp[] args, + final Map<String, Object> annotations) { super(args, annotations); - final IVariable<?>[] vars = (IVariable<?>[]) getProperty(Annotations.VARS); + final IVariable<?>[] vars = getVars(); if (vars != null && vars.length == 0) throw new IllegalArgumentException(); @@ -120,13 +121,13 @@ /** * @param op */ - public ChunkedMaterializationOp(ChunkedMaterializationOp op) { + public ChunkedMaterializationOp(final ChunkedMaterializationOp op) { super(op); } - public ChunkedMaterializationOp(final BOp[] args, NV... annotations) { + public ChunkedMaterializationOp(final BOp[] args, final NV... annotations) { this(args, NV.asMap(annotations)); @@ -154,6 +155,20 @@ } /** + * Return the variables to be materialized. + * + * @return The variables to be materialized -or- <code>null</code> iff all + * variables should be materialized. + * + * @see Annotations#VARS + */ + public IVariable<?>[] getVars() { + + return (IVariable<?>[]) getProperty(Annotations.VARS); + + } + + /** * When <code>true</code>, inline {@link IV}s are also materialized. * * @see Annotations#MATERIALIZE_INLINE_IVS @@ -165,6 +180,7 @@ } + @Override public FutureTask<Void> eval(final BOpContext<IBindingSet> context) { return new FutureTask<Void>(new ChunkTask(this, context)); @@ -195,11 +211,8 @@ this.context = context; - this.vars = (IVariable<?>[]) op.getProperty(Annotations.VARS); + this.vars = op.getVars(); - if (vars != null && vars.length == 0) - throw new IllegalArgumentException(); - namespace = ((String[]) op.getProperty(Annotations.RELATION_NAME))[0]; timestamp = (Long) op.getProperty(Annotations.TIMESTAMP); @@ -208,6 +221,7 @@ } + @Override public Void call() throws Exception { final BOpStats stats = context.getStats(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |