|
From: <tho...@us...> - 2010-09-29 16:57:27
|
Revision: 3682
http://bigdata.svn.sourceforge.net/bigdata/?rev=3682&view=rev
Author: thompsonbry
Date: 2010-09-29 16:57:20 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
Added a NOPFilter for stacking filters when you don't have one to start with.
Modified AccessPath to not assume BOpTupleFilter for the filters.
Modified Paths:
--------------
branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java
Added Paths:
-----------
branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/NOPFilter.java
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-29 16:37:18 UTC (rev 3681)
+++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java 2010-09-29 16:57:20 UTC (rev 3682)
@@ -40,8 +40,6 @@
import com.bigdata.bop.BOp;
import com.bigdata.bop.IPredicate;
import com.bigdata.bop.NV;
-import com.bigdata.bop.ap.filter.BOpFilterBase;
-import com.bigdata.bop.ap.filter.BOpTupleFilter;
import com.bigdata.bop.ap.filter.SameVariableConstraint;
import com.bigdata.bop.ap.filter.SameVariableConstraintFilter;
import com.bigdata.btree.BytesUtil;
@@ -65,7 +63,9 @@
import com.bigdata.striterator.IChunkedOrderedIterator;
import com.bigdata.striterator.IKeyOrder;
+import cutthecrap.utils.striterators.FilterBase;
import cutthecrap.utils.striterators.IFilter;
+import cutthecrap.utils.striterators.NOPFilter;
import cutthecrap.utils.striterators.Striterator;
/**
@@ -205,13 +205,13 @@
* is added regardless of whether the {@link IPredicate} specified a filter
* or not.
*/
- final protected BOpFilterBase indexLocalFilter;
+ final protected IFilter indexLocalFilter;
/**
* The filter derived from optional
* {@link IPredicate.Annotations#ACCESS_PATH_FILTER}.
*/
- final protected BOpFilterBase accessPathFilter;
+ final protected IFilter accessPathFilter;
/**
* Used to detect failure to call {@link #init()}.
@@ -373,8 +373,7 @@
* reuse of tuples within tuple iterators. That is why it is being
* cast to a BOpTupleIterator.
*/
- final BOpTupleFilter indexLocalFilter = (BOpTupleFilter<?>) predicate
- .getProperty(IPredicate.Annotations.INDEX_LOCAL_FILTER);
+ final IFilter indexLocalFilter = predicate.getIndexLocalFilter();
/*
* Optional constraint enforces the "same variable" constraint. The
@@ -389,13 +388,19 @@
/*
* Stack filters.
*/
- this.indexLocalFilter = new SameVariableConstraintFilter(
- (indexLocalFilter == null ? new BOp[0]
- : new BOp[] { indexLocalFilter }),
+ final FilterBase tmp = new NOPFilter();
+
+ if (indexLocalFilter != null)
+ tmp.addFilter(indexLocalFilter);
+
+ tmp.addFilter(new SameVariableConstraintFilter(
+ new BOp[] {},
NV.asMap(new NV[] { new NV(
- SameVariableConstraintFilter.Annotations.FILTER,
- sameVarConstraint) }));
+ SameVariableConstraintFilter.Annotations.FILTER,
+ sameVarConstraint) })));
+ this.indexLocalFilter = indexLocalFilter;
+
} else {
this.indexLocalFilter = indexLocalFilter;
@@ -405,8 +410,7 @@
}
// optional filter to be evaluated by the AccessPath.
- this.accessPathFilter = (BOpFilterBase) predicate
- .getProperty(IPredicate.Annotations.ACCESS_PATH_FILTER);
+ this.accessPathFilter = predicate.getAccessPathFilter();;
// true iff there is a filter (either local or remote).
this.hasFilter = (indexLocalFilter != null || accessPathFilter != null);
Added: branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/NOPFilter.java
===================================================================
--- branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/NOPFilter.java (rev 0)
+++ branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/NOPFilter.java 2010-09-29 16:57:20 UTC (rev 3682)
@@ -0,0 +1,56 @@
+/**
+
+Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved.
+
+Contact:
+ SYSTAP, LLC
+ 4501 Tower Road
+ Greensboro, NC 27410
+ lic...@bi...
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+/*
+ * Created on Sep 29, 2010
+ */
+
+package cutthecrap.utils.striterators;
+
+import java.util.Iterator;
+
+/**
+ * A filter which is initially a NOP. You can add other filters to this to stack
+ * them.
+ *
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ */
+public class NOPFilter extends FilterBase {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ */
+ public NOPFilter() {
+ }
+
+ @Override
+ protected Iterator filterOnce(Iterator src, Object context) {
+ return src;
+ }
+
+}
Property changes on: branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/NOPFilter.java
___________________________________________________________________
Added: svn:keywords
+ Id Date Revision Author HeadURL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|