From: <tho...@us...> - 2010-09-28 10:59:21
|
Revision: 3651 http://bigdata.svn.sourceforge.net/bigdata/?rev=3651&view=rev Author: thompsonbry Date: 2010-09-28 10:59:12 +0000 (Tue, 28 Sep 2010) Log Message: ----------- Dropped the ctc_utils jar in favor of the newly contributed CTC source code. Made a number of changes to reconciled the CTC striterators with the bigdata striterators and BOPs. More are too come. See https://sourceforge.net/apps/trac/bigdata/ticket/178. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/.classpath branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/notes.txt branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/AbstractBTree.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/ReadOnlyEntryIterator.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/Advancer.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/FilterConstructor.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/ITupleFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/LookaheadTupleFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/PrefixFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleRemover.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleTransformer.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleUpdater.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/view/FusedView.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/sparse/AtomicRowFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/ChunkedFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/DistinctFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/Striterator.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/btree/filter/TestRemoverator.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/RdfTypeRdfsResourceFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/rules/DoNotAddFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctSPOIterator.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctTermAdvancer.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/ExplicitSPOFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphBinarySearchFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphHashSetFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/InferredSPOFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/NoAxiomFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOFilter.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/FilterBase.java branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/Striterator.java branches/QUADS_QUERY_BRANCH/ctc-striterators/src/test/cutthecrap/utils/striterators/TestFilterBase.java Modified: branches/QUADS_QUERY_BRANCH/.classpath =================================================================== --- branches/QUADS_QUERY_BRANCH/.classpath 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/.classpath 2010-09-28 10:59:12 UTC (rev 3651) @@ -15,6 +15,8 @@ <classpathentry kind="src" path="contrib/src/problems"/> <classpathentry kind="src" path="bigdata/src/samples"/> <classpathentry kind="src" path="dsi-utils/src/test"/> + <classpathentry kind="src" path="ctc-striterators/src/java"/> + <classpathentry kind="src" path="ctc-striterators/src/test"/> <classpathentry kind="lib" path="bigdata-jini/lib/apache/zookeeper-3.2.1.jar"/> <classpathentry kind="lib" path="bigdata-sails/lib/commons-httpclient.jar"/> <classpathentry kind="lib" path="bigdata-sails/lib/servlet-api.jar"/> @@ -26,7 +28,6 @@ <classpathentry kind="src" path="lgpl-utils/src/test"/> <classpathentry exported="true" kind="lib" path="bigdata/lib/icu/icu4j-3_6.jar"/> <classpathentry exported="true" kind="lib" path="bigdata/lib/unimi/colt-1.2.0.jar"/> - <classpathentry exported="true" kind="lib" path="bigdata/lib/ctc_utils-5-4-2005.jar"/> <classpathentry exported="true" kind="lib" path="bigdata/lib/cweb-commons-1.1-b2-dev.jar"/> <classpathentry exported="true" kind="lib" path="bigdata/lib/cweb-extser-0.1-b2-dev.jar"/> <classpathentry exported="true" kind="lib" path="bigdata/lib/cweb-junit-ext-1.1-b3-dev.jar" sourcepath="/junit-ext/src"/> Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -31,6 +31,8 @@ import java.util.List; import java.util.Map; +import cutthecrap.utils.striterators.IPropertySet; + /** * An operator, such as a constant, variable, join, sort, filter, etc. * <p> @@ -53,7 +55,7 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ -public interface BOp extends Cloneable, Serializable { +public interface BOp extends Cloneable, Serializable, IPropertySet { /** * The #of arguments to the operation. @@ -114,7 +116,7 @@ * @return The value of the annotation and <code>null</code> if the * annotation is not bound. */ - <T> T getProperty(final String name); + //<T> T getProperty(final String name); // /** // * Return the value of the named annotation. Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -305,11 +305,17 @@ } - @SuppressWarnings("unchecked") - public <T> T getProperty(final String name) { +// @SuppressWarnings("unchecked") +// public <T> T getProperty(final String name) { +// +// return (T) annotations.get(name); +// +// } - return (T) annotations.get(name); + public Object getProperty(final String name) { + return annotations.get(name); + } // public <T> T getRequiredProperty(final String name) { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -30,29 +30,25 @@ import java.io.Serializable; +import com.bigdata.bop.join.PipelineJoin; import com.bigdata.btree.IRangeQuery; import com.bigdata.mdi.PartitionLocator; -import com.bigdata.relation.IMutableRelation; import com.bigdata.relation.IRelation; import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.relation.accesspath.IElementFilter; import com.bigdata.relation.rule.IRule; import com.bigdata.relation.rule.ISolutionExpander; -import com.bigdata.relation.rule.eval.ActionEnum; import com.bigdata.relation.rule.eval.IEvaluationPlan; -import com.bigdata.relation.rule.eval.ISolution; import com.bigdata.relation.rule.eval.pipeline.JoinMasterTask; -import com.bigdata.service.AbstractScaleOutFederation; -import com.bigdata.service.DataService; import com.bigdata.striterator.IKeyOrder; /** * An immutable constraint on the elements visited using an {@link IAccessPath}. * The slots in the predicate corresponding to variables are named and those - * names establish binding patterns access {@link IPredicate}s in the context - * of a {@link IRule}. Access is provided to slots by ordinal index regardless - * of whether or not they are named variables. + * names establish binding patterns access {@link IPredicate}s. Access is + * provided to slots by ordinal index regardless of whether or not they are + * named variables. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ @@ -189,18 +185,12 @@ /** * Resource identifier (aka namespace) identifies the {@link IRelation} * associated with this {@link IPredicate}. - * <p> - * This is more or less ignored when the {@link IRule} is executed as a - * query. - * <p> - * When the {@link IRule} is executed as an {@link ActionEnum#Insert} or - * {@link ActionEnum#Delete} then this identifies the target - * {@link IMutableRelation} on which the computed {@link ISolution}s will be - * written. * * @throws IllegalStateException * if there is more than on element in the view. * + * @see Annotations#RELATION_NAME + * * @todo Rename as getRelationName() */ public String getOnlyRelationName(); @@ -227,29 +217,12 @@ /** * The index partition identifier and <code>-1</code> if no partition * identifier was specified. - * <p> - * Note: The ability to specify an index partition identifier for a - * predicate is provided in support of scale-out JOIN strategies. The - * {@link AccessPath} and the {@link JoinMasterTask} are both aware - * of this property. The {@link JoinMasterTask} sets the partition - * identifier in order to request an access path backed by the name of the - * local index object on a {@link DataService} rather than the name of the - * scale-out index. - * <p> - * The index partition can not be specified until a choice has been made - * concerning which {@link IAccessPath} to use for a predicate without an - * index partition constraint. The {@link IAccessPath} choice is therefore - * made by the {@link IEvaluationPlan} using the scale-out index view and an - * {@link AbstractScaleOutFederation#locatorScan(String, long, byte[], byte[], boolean)} - * is used to identify the index partitions on which the {@link IAccessPath} - * will read. The index partition is then set on a constrained - * {@link IPredicate} for each target index partition and the JOINs are then - * distributed to the {@link DataService}s on which those index partitions - * reside. * * @return The index partition identifier -or- <code>-1</code> if the * predicate is not locked to a specific index partition. * + * @see Annotations#PARTITION_ID + * * @see PartitionLocator * @see AccessPath * @see JoinMasterTask @@ -268,9 +241,10 @@ * if the index partition identified is a negative integer. * @throws IllegalStateException * if the index partition identifier was already specified. + * @see Annotations#PARTITION_ID */ public IPredicate<E> setPartitionId(int partitionId); - + /** * <code>true</code> iff the predicate is optional when evaluated as the * right-hand side of a join. An optional predicate will match once after @@ -285,8 +259,10 @@ * More control over the behavior of optionals may be gained through the use * of an {@link ISolutionExpander} pattern. * - * @return <code>true</code> iff this predicate is optional when - * evaluating a JOIN. + * @return <code>true</code> iff this predicate is optional when evaluating + * a JOIN. + * + * @deprecated By {@link PipelineJoin.Annotations#OPTIONAL} */ public boolean isOptional(); @@ -296,6 +272,8 @@ * * @return The {@link ISolutionExpander}. * + * @see Annotations#EXPANDER + * * @todo replace with {@link ISolutionExpander#getAccessPath(IAccessPath)}, * which is the only method declared by {@link ISolutionExpander}. */ @@ -304,6 +282,8 @@ /** * An optional constraint on the visitable elements. * + * @see Annotations#CONSTRAINT + * * @todo rename as get(Element)Filter(). */ public IElementFilter<E> getConstraint(); @@ -328,6 +308,8 @@ * The {@link IKeyOrder}. * * @return The new {@link IPredicate}. + * + * @see Annotations#KEY_ORDER */ public IPredicate<E> setKeyOrder(final IKeyOrder<E> keyOrder); @@ -499,4 +481,5 @@ * @return The newly annotated {@link IPredicate}. */ public IPredicate<E> setBOpId(int bopId); + } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/notes.txt =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/notes.txt 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/notes.txt 2010-09-28 10:59:12 UTC (rev 3651) @@ -2,16 +2,42 @@ - TestJiniFederatedQueryEngine. - - Join=ANY, Predicate=RMI. + - Reconcile IElementFilter, FilterConstructor, and stackable + striterators for access paths and raw iterators. We should be + able to use any of the striterator patterns! - - Unit tests of the default and named graph access path patterns. + There are a lot of partially duplicated classes which need to be + cleared up. This can be tested on the individual striterator / + filter and also on the local and remote access paths. - - Cost model for the default graph and named graph access path - patterns so we can choose the right one for each query. + Note: Some filters can be sent with a remote iterator request (for + example, the advancer), but most are applied after we convert from + tuples into elements. - - Subqueries {Union,Steps,Star}. Implement subquery support. (We - can't test Star until we have the mutation API in place.) + IFilterConstructor only works with ITupleIterator. + IElementFilter only filters. It can not resolve, transform, chunk, + etc. It is currently sent with the iterator to the B+Tree. See + AccessPath#iterator(). + + - Break the DistinctSPOIterator into a Distinct(Element)Filter and a + StripContextFilter. + + - AbstractTuple#getObject() should cache the materialized object + since some patterns used by an AccessPath may request the object + multiple times. Of course, caching implies that we must clear the + reference when advancing the iterator. Check TupleFilter and + friends since there might need to be more than once class which + caches the object. Clear the reference when the iterator is + exhausted. + + - Adapt the code to use the cost models and decision trees and write + Unit tests of the default and named graph access path patterns. + + - Implement subquery support and subquery operators {Union, Steps, + Star}. (We can't test Star until we have the mutation API in + place.) + - PipelineType {Vectored,OneShot}. A vectored operator processes its inputs in chunks, producing @@ -28,6 +54,10 @@ ConcurrencyManager as appropriate (but how can we tell which is appropriate!?!). + Note: AccessPath currently does not allow inserts (just + deletes). Hopefully it can be extended to allow INSERT and UPDATE + so we can use the same abstraction for mutation operators. + - Mutation {Create, Destroy}. This gets into resource management, so defer for the moment but tackle in the context of RDFS closure using STAR. @@ -461,4 +491,57 @@ * <li></li> * <li></li> * </ul> - \ No newline at end of file + + +Martyn, + +Rationalizing CTC striterators, bigdata striterators, and access paths: + +Dropped the ctc_utils jar and added the source files to the classpath. + +I've added an IPropertySet interface: + +Object getProperty(String name). + +There are currently several varieties of IFilter. Each one knows how to create its corresponding implementation class. This exactly parallels the bops, where a concrete bop such as MemorySortOp, knows how to create the corresponding runtime class, MemorySortOp.SortTask. I've added a filterOnce() method to provide the semantics of wrapping an iterator with just that IFilter. The existing filter() method now wraps the chain, starting with _this_ IFilter and then wrapping anything which was added to the chain. The chain is empty if nothing was added. I've modified the various IFilter implementations to conform with this. + +I've modified all of the implementation classes (Appenderator, etc.) to accept the new context argument regardless of whether they use it. I have also modified them to always have the reference to the IFilter object so the IPropertySet will be accessible. + +Modified Uniqueness filter to use a linked hash map. + +Modified Sorter uses Arrays.sort() rather than TreeSort. + +Some problems: + +- Should Appender simply pass the other iterator as m_state to the FilterBase? + +- Mapper uses non-Serializable "Method". We should provide defered reflection for the method. + +- Merger uses non-Serializable "Iterator". + +- Sorter and Resolver should use an annotation pattern so we can create instances from Prolog of the operator. I do not think we can do this when the operator is abstract. Maybe we can have two "Resolver" classes, two "Sorter" classes, etc. The simple one can be used for inline programming. The other one will extend BOpBase and implement IFilter and will be used for query. + +- CONTRACTOR should be able to break an iterator into many chunks, not just one. Maybe the API should return an Iterator from an Iterator in which the chunkiness is changed (from element to element[])? + +Here is what I have not done yet: + +Write unit tests to sanity check these changes. + +Write BOp versions of Append, Expand, etc. These will extend BOpBase. + +The following places directly invoke filterOnce(src,ctx). The first two should be modified to pass in the correct context object. That might require raising a context object into an IRangeIterator parameter. + +AbstractBTree#2933 +FusedView#1281 +TestRemoverator#86 + +Replace (I)FilterConstructor with IFilter. FilterConstructor implemented clone. I am not sure that I can recall why. Presumably because a cloned would have a distinct filter chain. We can not easily override clone() on FilterBase because of all the derived versions. We could have a deep copy constructor pattern, which is what I did for the BOpBase class and then use that for clone. + +Replace the IPredicate "CONSTRAINT" with "REMOTE_FILTERS" (an IFilter which is evaluated at the BTree) and "LOCAL_FILTERS" (an IFilter which is evaluated against the range iterator once it is materialized on the local node). If the index is local, then the same concepts apply but we do not have to serialize the REMOTE_FILTERS. For the moment, the AccessPath automatically resolves ITuples to relation elements and adds the SameVariableConstraint if necessary. We might shift the burden of responsibility for this to the query planner in the future. + +Write unit tests at the IPredicate/AccessPath level to use stackable filters. + +Fixed the build.xml script to accomodate the class path changes. + +Thanks, +Bryan Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/AbstractBTree.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/AbstractBTree.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/AbstractBTree.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -2930,7 +2930,7 @@ // remove all visited tuples. return true; } - }.filter(src); + }.filterOnce(src, null/* context */); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/ReadOnlyEntryIterator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/ReadOnlyEntryIterator.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/ReadOnlyEntryIterator.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -34,20 +34,20 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ -public class ReadOnlyEntryIterator implements ITupleIterator { +public class ReadOnlyEntryIterator<E> implements ITupleIterator<E> { - private final ITupleIterator src; + private final ITupleIterator<E> src; /** * */ - public ReadOnlyEntryIterator(ITupleIterator src) { + public ReadOnlyEntryIterator(final ITupleIterator<E> src) { this.src = src; } - public ITuple next() { + public ITuple<E> next() { return src.next(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/Advancer.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/Advancer.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/Advancer.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -12,6 +12,8 @@ import com.bigdata.btree.KeyOutOfRangeException; import com.bigdata.io.ByteArrayBuffer; +import cutthecrap.utils.striterators.FilterBase; + /** * Used to write logic that advances an {@link ITupleCursor} to another key * after it visits some element. For example, the "distinct term scan" for @@ -26,12 +28,15 @@ * the key for the last visited tuple and then issue remove(key) * against the underlying index. */ -abstract public class Advancer<E> implements ITupleFilter<E> { +abstract public class Advancer<E> extends FilterBase implements ITupleFilter<E> { + /** + * + */ + private static final long serialVersionUID = 1L; + protected transient static final Logger log = Logger.getLogger(Advancer.class); - protected transient static final boolean INFO = log.isInfoEnabled(); - /** * Set by {@link #filter(ITupleCursor)}. */ @@ -48,11 +53,13 @@ * @return */ @SuppressWarnings("unchecked") - final public ITupleIterator<E> filter(final Iterator src) { + @Override + final public ITupleIterator<E> filterOnce(final Iterator src, + final Object context) { this.src = (ITupleCursor<E>) src; - return new Advancer.Advancerator<E>(this.src, this); + return new Advancer.Advancerator<E>(this.src, context, this); } @@ -75,6 +82,7 @@ private static class Advancerator<E> implements ITupleIterator<E> { final private ITupleCursor<E> src; + final protected Object context; final private Advancer<E> filter; @@ -95,10 +103,13 @@ */ final private ByteArrayBuffer kbuf = new ByteArrayBuffer(); - public Advancerator(final ITupleCursor<E> src, final Advancer<E> filter) { + public Advancerator(final ITupleCursor<E> src, Object context, + final Advancer<E> filter) { this.src = src; + this.context = context; + this.filter = filter; } @@ -115,7 +126,7 @@ final ITuple<E> tuple = src.next(); - if (INFO) { + if (log.isInfoEnabled()) { log.info("next: " + tuple); @@ -156,7 +167,7 @@ final byte[] key = this.kbuf.toByteArray(); - if (INFO) { + if (log.isInfoEnabled()) { log.info("key=" + BytesUtil.toString(key)); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/FilterConstructor.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/FilterConstructor.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/FilterConstructor.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -90,9 +90,9 @@ */ private static class WrappedTupleIterator<E> implements ITupleIterator<E> { - final private Iterator src; + final private Iterator<E> src; - public WrappedTupleIterator(final Iterator src) { + public WrappedTupleIterator(final Iterator<E> src) { if (src == null) throw new IllegalArgumentException(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/ITupleFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/ITupleFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/ITupleFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -53,7 +53,9 @@ /** * Strengthened return type. + * <p> + * {@inheritDoc} */ - public ITupleIterator<E> filter(Iterator src); + public ITupleIterator<E> filterOnce(Iterator src, Object context); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/LookaheadTupleFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/LookaheadTupleFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/LookaheadTupleFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -37,6 +37,8 @@ import com.bigdata.btree.ITupleIterator; import com.bigdata.btree.ITupleSerializer; +import cutthecrap.utils.striterators.FilterBase; + /** * Lookahead filter for an {@link ITuple}. You can push back a single * {@link ITuple} onto the filter. @@ -46,7 +48,7 @@ * * @todo unit tests. */ -public class LookaheadTupleFilter<E> implements ITupleFilter<E> { +public class LookaheadTupleFilter<E> extends FilterBase implements ITupleFilter<E> { private static final long serialVersionUID = -5551926378159692251L; @@ -77,14 +79,15 @@ } @SuppressWarnings("unchecked") - public ILookaheadTupleIterator<E> filter(Iterator src) { + @Override + public ILookaheadTupleIterator<E> filterOnce(Iterator src, Object context) { if(src instanceof ITupleCursor) { - return new LookaheadTupleCursor((ITupleCursor)src); + return new LookaheadTupleCursor((ITupleCursor)src, context); } - return new LookaheadTupleIterator((ITupleIterator)src); + return new LookaheadTupleIterator((ITupleIterator)src, context); } @@ -98,12 +101,13 @@ static private class LookaheadTupleCursor<E> implements ILookaheadTupleIterator<E> { private final ITupleCursor<E> src; + private final Object context; private boolean pushbackAllowed = false; - public LookaheadTupleCursor(ITupleCursor<E> src) { + public LookaheadTupleCursor(ITupleCursor<E> src, Object context) { this.src = src; - + this.context = context; } public void pushback() { @@ -151,6 +155,7 @@ static private class LookaheadTupleIterator<E> implements ILookaheadTupleIterator<E> { private final ITupleIterator<E> src; + private final Object context; /** * <code>true</code> iff pushback is allowed. when <code>true</code>, @@ -171,9 +176,10 @@ /** * @param src */ - public LookaheadTupleIterator(ITupleIterator<E> src) { - + public LookaheadTupleIterator(ITupleIterator<E> src, Object context) { + this.src = src; + this.context = context; } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/PrefixFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/PrefixFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/PrefixFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -13,6 +13,8 @@ import com.bigdata.btree.keys.StrengthEnum; import com.bigdata.btree.keys.SuccessorUtil; +import cutthecrap.utils.striterators.FilterBase; + /** * <p> * Filter visits all {@link ITuple}s whose keys begin with any of the specified @@ -103,16 +105,12 @@ * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ - * - * @see TestPrefixFilter */ -public class PrefixFilter<E> implements ITupleFilter<E> { +public class PrefixFilter<E> extends FilterBase implements ITupleFilter<E> { protected transient static final Logger log = Logger .getLogger(PrefixFilter.class); - protected transient static final boolean INFO = log.isInfoEnabled(); - private static final long serialVersionUID = 1828228416774862469L; /** @@ -163,9 +161,10 @@ } @SuppressWarnings("unchecked") - public ITupleIterator<E> filter(Iterator src) { + @Override + public ITupleIterator<E> filterOnce(Iterator src, Object context) { - return new PrefixFilterator<E>((ITupleCursor<E>) src, this); + return new PrefixFilterator<E>((ITupleCursor<E>) src, context, this); } @@ -177,8 +176,10 @@ * successor of the last key prefix (formed by adding one bit, not by * appending a <code>nul</code> byte). */ - protected final ITupleCursor<E> src; + private final ITupleCursor<E> src; + private final Object context; + private final PrefixFilter<E> filter; /** @@ -204,7 +205,8 @@ * @param filter * The filter to be applied. */ - public PrefixFilterator(ITupleCursor<E> src, PrefixFilter<E> filter) { + public PrefixFilterator(final ITupleCursor<E> src, + final Object context, final PrefixFilter<E> filter) { if (src == null) throw new IllegalArgumentException(); @@ -214,6 +216,8 @@ this.src = src; + this.context = context; + this.filter = filter; this.index = 0; @@ -238,7 +242,7 @@ if (BytesUtil.compareBytes(key, toKey) >= 0) { - if (INFO) + if (log.isInfoEnabled()) log.info("Scanned beyond prefix: toKey=" + BytesUtil.toString(toKey) + ", tuple=" + tuple); @@ -261,7 +265,7 @@ } - if(INFO) + if(log.isInfoEnabled()) log.info("No more prefixes."); return false; @@ -277,7 +281,7 @@ // no more tuples (at least in this index partition). - if(INFO) + if(log.isInfoEnabled()) log.info("No more tuples."); return false; @@ -303,7 +307,7 @@ current = src.seek(prefix); // current = src.tuple(); - if (INFO) { + if (log.isInfoEnabled()) { log.info("index=" + index + ", prefix=" + BytesUtil.toString(prefix) + ", current=" + current); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -17,6 +17,7 @@ import com.bigdata.btree.Tuple; import cutthecrap.utils.striterators.Filter; +import cutthecrap.utils.striterators.FilterBase; /** * <p> @@ -47,14 +48,19 @@ * The type of the elements visited by the iterator (tuples of some * sort). */ -abstract public class TupleFilter<E> implements ITupleFilter<E> { +abstract public class TupleFilter<E> extends FilterBase implements ITupleFilter<E> { + /** + * + */ + private static final long serialVersionUID = 1L; + protected static transient final Logger log = Logger.getLogger(TupleFilter.class); - /** - * Optional state specified by the ctor. - */ - protected Object state; +// /** +// * Optional state specified by the ctor. +// */ +// protected Object state; public TupleFilter() { @@ -62,16 +68,18 @@ } - public TupleFilter(Object state) { + public TupleFilter(final Object state) { - this.state = state; +// this.state = state; + super(state); } @SuppressWarnings("unchecked") - public ITupleIterator<E> filter(Iterator src) { + @Override + public ITupleIterator<E> filterOnce(final Iterator src,Object context) { - return new TupleFilter.Filterator((ITupleIterator) src); + return new TupleFilter.Filterator((ITupleIterator) src, context, this); } @@ -85,7 +93,7 @@ * @version $Id$ * @param <E> */ - protected class Filterator implements ITupleIterator<E> { + static protected class Filterator<E> implements ITupleIterator<E> { /** * The source iterator. @@ -93,9 +101,16 @@ protected final ITupleIterator<E> src; /** + * The context. + */ + protected final Object context; + + protected final TupleFilter<E> filter; + + /** * The next value to be returned by {@link #next()}. */ - private ITuple nextValue = null; + private ITuple<E> nextValue = null; /** * The {@link ITuple} instance that will actually be returned to the @@ -107,11 +122,14 @@ * of the data must be made in order to avoid side-effects from the * one-step lookahead used by the filter. */ - final private AbstractTuple returnValue; + final private AbstractTuple<E> returnValue; - public Filterator(final ITupleIterator<E> src) { + public Filterator(final ITupleIterator<E> src, final Object context, + final TupleFilter<E> filter) { this.src = src; + this.context = context; + this.filter = filter; /* * One step lookahead. @@ -161,7 +179,7 @@ } - @SuppressWarnings("unchecked") +// @SuppressWarnings("unchecked") public ITuple<E> next() { if (!hasNext()) @@ -182,7 +200,7 @@ visit(returnValue); // return the private instance containing a copy of the data. - return (ITuple<E>)returnValue; + return (ITuple<E>) returnValue; } @@ -193,7 +211,7 @@ * @param tuple * The tuple that will be visited. */ - protected void visit(ITuple<E> tuple) { + protected void visit(final ITuple<E> tuple) { // NOP @@ -220,7 +238,7 @@ */ public void remove() { - if(src instanceof ITupleCursor) { + if(src instanceof ITupleCursor<?>) { /* * The ITupleCursor supports traversal with concurrent @@ -262,13 +280,13 @@ * * @return The next object to be visited. */ - protected ITuple getNext() { + protected ITuple<E> getNext() { while (src.hasNext()) { final ITuple<E> next = src.next(); - if (!isValid(next)) { + if (!filter.isValid(next)) { if(log.isInfoEnabled()) { @@ -286,7 +304,7 @@ } - return (ITuple) next; + return next; } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleRemover.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleRemover.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleRemover.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -8,6 +8,8 @@ import com.bigdata.btree.ITuple; import com.bigdata.btree.ITupleIterator; +import cutthecrap.utils.striterators.FilterBase; + /** * Visits all elements visited by the source iterator and removes those * matching the filter. @@ -23,13 +25,20 @@ * @version $Id$ * @param <E> */ -abstract public class TupleRemover<E> implements ITupleFilter<E> { +abstract public class TupleRemover<E> extends FilterBase implements ITupleFilter<E> { + /** + * + */ + private static final long serialVersionUID = 1L; + @SuppressWarnings("unchecked") - public ITupleIterator<E> filter(Iterator src) { + @Override + public ITupleIterator<E> filterOnce(final Iterator src, Object context) { - return new TupleRemover.Removerator<E>((ITupleIterator<E>) src, this); - + return new TupleRemover.Removerator<E>((ITupleIterator<E>) src, + context, this); + } /** @@ -55,6 +64,11 @@ * The source iterator. */ private final ITupleIterator<E> src; + + /** + * The context object (ignored). + */ + private final Object ctx; /** * The filter to be applied. @@ -65,10 +79,13 @@ * @param src * @param filter */ - public Removerator(ITupleIterator<E> src, TupleRemover<E> filter) { - + public Removerator(final ITupleIterator<E> src, final Object context, + final TupleRemover<E> filter) { + this.src = src; + this.ctx = context; + this.filter = filter; } @@ -113,4 +130,4 @@ } -} \ No newline at end of file +} Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleTransformer.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleTransformer.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleTransformer.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -34,6 +34,8 @@ import com.bigdata.btree.ITupleSerializer; import com.bigdata.btree.filter.LookaheadTupleFilter.ILookaheadTupleIterator; +import cutthecrap.utils.striterators.FilterBase; + /** * Abstract base class for an {@link ITupleFilter} that transforms the data type * of the keys and/or values. @@ -52,7 +54,8 @@ * one out) and patterns with a M:1 (many in, one out) and 1:M (1 in, many * out)? */ -abstract public class TupleTransformer<E,F> implements ITupleFilter<F> { +abstract public class TupleTransformer<E, F> extends FilterBase implements + ITupleFilter<F> { /** The serialization provider for the transformed tuples. */ final protected ITupleSerializer<? extends Object/*key*/,F/*val*/> tupleSer; @@ -76,13 +79,15 @@ * The source iterator. */ @SuppressWarnings("unchecked") - public ITupleIterator<F> filter(Iterator src) { + @Override + public ITupleIterator<F> filterOnce(Iterator src, final Object context) { // layer in one-step lookahead. - src = new LookaheadTupleFilter().filter((ITupleIterator<E>)src); + src = new LookaheadTupleFilter().filterOnce((ITupleIterator<E>) src, + context); // the transformer. - return newTransformer((ILookaheadTupleIterator<E>)src); + return newTransformer((ILookaheadTupleIterator<E>) src, context); } @@ -91,7 +96,8 @@ * from the lookahead source whose tuples are of the source type and visits * the transformed tuples. */ - abstract protected ITupleIterator<F> newTransformer(ILookaheadTupleIterator<E> src); + abstract protected ITupleIterator<F> newTransformer( + final ILookaheadTupleIterator<E> src, final Object context); // /** // * Return <code>true</code> iff another tuple of the transformed type can Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleUpdater.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleUpdater.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/filter/TupleUpdater.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -32,9 +32,10 @@ } @SuppressWarnings("unchecked") - public ITupleIterator<E> filter(Iterator src) { + @Override + public ITupleIterator<E> filterOnce(Iterator src, Object context) { - return new Updaterator((ITupleCursor<E>) src); + return new Updaterator((ITupleCursor<E>) src, context, this); } @@ -52,17 +53,19 @@ */ abstract protected void update(IIndex ndx, ITuple<E> tuple); - protected class Updaterator extends TupleFilter.Filterator { + protected class Updaterator extends TupleFilter.Filterator<E> { - public Updaterator(ITupleIterator<E> src) { + public Updaterator(final ITupleIterator<E> src, final Object context, + final TupleFilter<E> filter) { - super(src); + super(src, context, filter); } - protected void visit(ITuple tuple) { + @Override + protected void visit(final ITuple<E> tuple) { - final IIndex ndx = ((ITupleCursor) src).getIndex(); + final IIndex ndx = ((ITupleCursor<E>) src).getIndex(); update(ndx, tuple); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/view/FusedView.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/view/FusedView.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/view/FusedView.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -1278,7 +1278,7 @@ // remove all visited tuples. return true; } - }.filter(src); + }.filterOnce(src, null/* context */); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -77,8 +77,7 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ * @param R - * The generic type of the [R]elation elements of the - * {@link IRelation}. + * The generic type of the elements of the {@link IRelation}. * * @todo This needs to be more generalized so that you can use a index that is * best without being optimal by specifying a low-level filter to be @@ -234,50 +233,7 @@ } -// protected void setFromKey(final byte[] fromKey) { -// -// assertNotInitialized(); -// -// if (pmd != null) { -// -// /* -// * The predicate is constrained to an index partition, so constrain -// * the fromKey so that it lies within that index partition. -// */ -// -// this.fromKey = AbstractKeyRangeIndexProcedure.constrainFromKey(fromKey, -// pmd); -// -// } else { -// -// this.fromKey = fromKey; -// -// } -// -// } -// -// protected void setToKey(final byte[] toKey) { -// -// assertNotInitialized(); -// -// if (pmd != null) { -// -// /* -// * The predicate is constrained to an index partition, so constrain -// * the toKey so that it lies within that index partition. -// */ -// -// this.toKey = AbstractKeyRangeIndexProcedure.constrainToKey(toKey, pmd); -// -// } else { -// -// this.toKey = toKey; -// -// } -// -// } - - public IKeyOrder<R> getKeyOrder() { + final public IKeyOrder<R> getKeyOrder() { return keyOrder; @@ -393,7 +349,6 @@ this.chunkCapacity = chunkCapacity; -// this.fullyBufferedReadThreshold = 100000; this.fullyBufferedReadThreshold = fullyBufferedReadThreshold; this.historicalRead = TimestampUtility.isReadOnly(timestamp); @@ -416,6 +371,9 @@ } else { + /* + * Stack filters. + */ filter = new FilterConstructor<R>(); if (constraint != null) { @@ -1074,10 +1032,6 @@ static private class ChunkConsumerTask<R> implements Callable<Void> { static protected final Logger log = Logger.getLogger(ChunkConsumerTask.class); - -// static protected final boolean log.isInfoEnabled() = log.isInfoEnabled(); -// -// static protected final boolean log.isDebugEnabled() = log.isDebugEnabled(); private final AccessPath<R> accessPath; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/sparse/AtomicRowFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/sparse/AtomicRowFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/sparse/AtomicRowFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -72,9 +72,9 @@ protected static transient final Logger log = Logger .getLogger(AtomicRowFilter.class); - protected static transient final boolean INFO = log.isInfoEnabled(); - - protected static transient final boolean DEBUG = log.isDebugEnabled(); +// protected static transient final boolean INFO = log.isInfoEnabled(); +// +// protected static transient final boolean DEBUG = log.isDebugEnabled(); private final Schema schema; @@ -119,10 +119,10 @@ @Override protected ITupleIterator<TPS> newTransformer( - ILookaheadTupleIterator<TPV> src) { + ILookaheadTupleIterator<TPV> src, final Object context) { - return new Transformerator<TPV, TPS>(src); - + return new Transformerator<TPV, TPS>(src, context); + } private class Transformerator<E extends TPV/* src */, F extends TPS/* out */> @@ -147,6 +147,8 @@ private final ILookaheadTupleIterator<E> src; + private final Object context; + /** * Builds iterator that reads the source tuples and visits the transformed * tuples. @@ -154,13 +156,15 @@ * @param src * Visits the source tuples. */ - public Transformerator(final ILookaheadTupleIterator<E> src) { + public Transformerator(final ILookaheadTupleIterator<E> src, final Object context) { - if (src == null) - throw new IllegalArgumentException(); + if (src == null) + throw new IllegalArgumentException(); - this.src = src; + this.src = src; + this.context = context; + } /** @@ -336,7 +340,7 @@ // Skip property names that have been filtered out. - if (DEBUG) { + if (log.isDebugEnabled()) { log.debug("Skipping property: name=" + col + " (filtered)"); @@ -355,7 +359,7 @@ if (columnValueTimestamp < fromTime) { - if (DEBUG) { + if (log.isDebugEnabled()) { log.debug("Ignoring earlier revision: col=" + col + ", fromTime=" + fromTime + ", timestamp=" @@ -369,7 +373,7 @@ if (toTime != CURRENT_ROW && columnValueTimestamp >= toTime) { - if (DEBUG) { + if (log.isDebugEnabled()) { log.debug("Ignoring later revision: col=" + col + ", toTime=" + toTime + ", timestamp=" @@ -398,7 +402,7 @@ tps.set(col, columnValueTimestamp, v); - if (INFO) + if (log.isInfoEnabled()) log.info("Accept: name=" + col + ", timestamp=" + columnValueTimestamp + ", value=" + v + ", key=" + BytesUtil.toString(key)); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/ChunkedFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/ChunkedFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/ChunkedFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -46,12 +46,17 @@ * will differ from {@link E} iff the filter is transforming the * element type. * - * @todo This class is redundent with the {@link ChunkedConvertingIterator} + * @todo This class is redundant with the {@link ChunkedConvertingIterator} */ abstract public class ChunkedFilter<I extends IChunkedIterator<E>, E, F> implements IFilter<I, E, F> { /** + * + */ + private static final long serialVersionUID = 1L; + + /** * Caller's object. */ protected Object state; @@ -72,7 +77,7 @@ } - public ChunkedFilter(Object state) { + public ChunkedFilter(final Object state) { this(state, null/* keyOrder */); @@ -85,7 +90,7 @@ * @param keyOrder * The natural sort order for the filtered iterator (optional). */ - public ChunkedFilter(Object state, IKeyOrder<F> keyOrder) { + public ChunkedFilter(final Object state, final IKeyOrder<F> keyOrder) { this.state = state; @@ -93,7 +98,7 @@ } - public IChunkedOrderedIterator<F> filter(I src) { + public IChunkedOrderedIterator<F> filter(final I src) { return new ChunkedFilteringIterator<I, E, F>(src, this); @@ -103,7 +108,7 @@ * @todo the need for this variant is worrysome - it is required if you do * NOT specify the generic types and then try to use this class. */ - public IChunkedOrderedIterator<F> filter(Iterator src) { + public IChunkedOrderedIterator<F> filter(final Iterator src) { return new ChunkedFilteringIterator<I, E, F>((I) src, this); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/DistinctFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/DistinctFilter.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/DistinctFilter.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.UUID; +import com.bigdata.bop.solutions.DistinctBindingSetOp; import com.bigdata.btree.BTree; import com.bigdata.btree.BytesUtil; import com.bigdata.btree.IndexMetadata; @@ -69,6 +70,8 @@ * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ + * + * @deprecated by {@link DistinctBindingSetOp} */ abstract public class DistinctFilter<E> implements IChunkConverter<E, E> { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/Striterator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/Striterator.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/striterator/Striterator.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -67,7 +67,7 @@ /** * @param src The source iterator. */ - public Striterator(I src) { + public Striterator(final I src) { if (src == null) throw new IllegalArgumentException(); @@ -79,8 +79,8 @@ /** * Wraps the enumeration as an iterator. * - * <strong>Ctor must be overriden for derived classes that specialize the - * type of the iterator.</strong> + * <strong>The constructor must be overridden for derived classes that + * specialize the type of the iterator.</strong> * * @param srcEnum * The source enumeration. @@ -107,7 +107,7 @@ } @SuppressWarnings("unchecked") - public IStriterator<I, E> addFilter(IFilter<I, ?, E> filter) { + public IStriterator<I, E> addFilter(final IFilter<I, ?, E> filter) { src = (I)filter.filter((I) src); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -1156,6 +1156,10 @@ /** * FIXME Test the ability run a query reading on an access path using a * DISTINCT filter (this is just stacking a striterator on the access path). + * + * @see DistinctSPOIterator, which should stack as a striterator. It might + * be best to break it up into something to strip off the context + * position and a distincterator. */ public void test_query_join1_distinctAccessPath() { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -69,6 +69,7 @@ import com.bigdata.journal.BufferMode; import com.bigdata.journal.ITx; import com.bigdata.journal.Journal; +import com.bigdata.rdf.spo.DistinctSPOIterator; import com.bigdata.relation.accesspath.IAsynchronousIterator; import com.bigdata.relation.accesspath.ThickAsynchronousIterator; import com.bigdata.service.AbstractEmbeddedFederationTestCase; @@ -1028,6 +1029,10 @@ * RMI access path, stacking a distinct filter on the access path, and * marking the join evaluation context as ANY since we do not push the * binding sets to the shards when using RMI access paths. + * + * @see DistinctSPOIterator, which should stack as a striterator. It might + * be best to break it up into something to strip off the context + * position and a distincterator. */ public void test_query_join1_distinctAccessPath() { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/btree/filter/TestRemoverator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/btree/filter/TestRemoverator.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/btree/filter/TestRemoverator.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -83,7 +83,7 @@ // all visited tuples will be removed. return true; } - }.filter(newCursor(btree)); + }.filterOnce(newCursor(btree), null/* context */); assertTrue(itr.hasNext()); Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java 2010-09-28 10:42:00 UTC (rev 3650) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java 2010-09-28 10:59:12 UTC (rev 3651) @@ -34,7 +34,6 @@ import org.apache.log4j.Logger; import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.TermId; import com.bigdata.rdf.lexicon.ITermIVFilter; import com.bigdata.rdf.model.StatementEnum; import com.bigdata.rdf.rules.InferenceEngine; @@ -44,7 +43,6 @@ import com.bigdata.rdf.spo.SPOKeyOrder; import com.bigdata.rdf.spo.SPORelation; import com.bigdata.rdf.store.AbstractTripleStore; -import com.bigdata.rdf.store.IRawTripleStore; import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.striterator.ChunkedArrayIterator; import com.bigdata.striterator.IChunkedIterator; @@ -53,7 +51,7 @@ import com.bigdata.striterator.IKeyOrder; import cutthecrap.utils.striterators.Filter; -import cutthecrap.utils.striterators.IFilter; +import cutthecrap.utils.striterators.FilterBase; import cutthecrap.utils.striterators.Resolver; import cutthecrap.utils.striterators.Striterator; @@ -814,7 +812,7 @@ * @version $Id$ * @param <E> */ - public static class PushbackFilter<E> implements IFilter { + public static class PushbackFilter<E> extends FilterBase { /** * @@ -822,7 +820,7 @@ private static final long serialVersionUID = -8010263934867149205L; @SuppressWarnings("unchecked") - public PushbackIterator<E> filter(Iterator src) { + public PushbackIterator<E> filterOnce(Iterator src, Object context) { return new PushbackIterator<E>((Iterator<E>) src); @@ -853,7 +851,7 @@ */ private E buffer; - public PushbackIterator(Iterator<E> src) { + public PushbackIterator(final Iterator<E> src) { if (src == null) throw new IllegalArgumentException(); Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/inf/RdfTypeRdfsResourceFilter.java ========================... [truncated message content] |