com.bigdata.btree.proc
Class RangeCountProcedure

java.lang.Object
  extended by com.bigdata.btree.proc.AbstractIndexProcedure
      extended by com.bigdata.btree.proc.AbstractKeyRangeIndexProcedure
          extended by com.bigdata.btree.proc.RangeCountProcedure
All Implemented Interfaces:
IIndexProcedure, IKeyRangeIndexProcedure, IParallelizableIndexProcedure, Externalizable, Serializable

public class RangeCountProcedure
extends AbstractKeyRangeIndexProcedure
implements IParallelizableIndexProcedure

This procedure computes a range count on an index.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.bigdata.btree.proc.AbstractKeyRangeIndexProcedure
fromKey, toKey
 
Constructor Summary
RangeCountProcedure()
          De-serialization ctor.
RangeCountProcedure(boolean exact, boolean deleted, byte[] fromKey, byte[] toKey)
          Range count using the specified bounds.
 
Method Summary
 Object apply(IIndex ndx)
           Range count of entries in a key range for the index.
 boolean isReadOnly()
          Return true iff the procedure asserts that it will not write on the index.
 void readExternal(ObjectInput in)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class com.bigdata.btree.proc.AbstractKeyRangeIndexProcedure
constrainFromKey, constrainToKey, getFromKey, getToKey, readKeys, writeKeys
 
Methods inherited from class com.bigdata.btree.proc.AbstractIndexProcedure
getKeyBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeCountProcedure

public RangeCountProcedure()
De-serialization ctor.


RangeCountProcedure

public RangeCountProcedure(boolean exact,
                           boolean deleted,
                           byte[] fromKey,
                           byte[] toKey)
Range count using the specified bounds.

Parameters:
exact - iff an exact range count is required.
deleted - iff deleted tuples must be included in the count.
fromKey - The lower bound (inclusive) -or- null if there is no lower bound.
toKey - The upper bound (exclusive) -or- null if there is no upper bound.
Throws:
IllegalArgumentException - if exact is false and deleted is true (there is no approximate reporting for range counts of deleted and undeleted tuples).
Method Detail

isReadOnly

public final boolean isReadOnly()
Description copied from interface: IIndexProcedure
Return true iff the procedure asserts that it will not write on the index. When true, the procedure may be run against a view of the index that is read-only or which allows concurrent processes to read on the same index object. When false the procedure will be run against a mutable view of the index (assuming that the procedure is executed in a context that has access to a mutable index view).

Specified by:
isReadOnly in interface IIndexProcedure

apply

public Object apply(IIndex ndx)

Range count of entries in a key range for the index.

Note: When the index IndexMetadata.getDeleteMarkers() this method reports the upper bound estimate of the #of key-value pairs in the key range of the index. The estimate is an upper bound because duplicate or deleted entries in that have not been eradicated through a suitable compacting merge will be reported. An exact count may be obtained using a range iterator by NOT requesting either the keys or the values.

Specified by:
apply in interface IIndexProcedure
Parameters:
ndx - The index.
Returns:
The upper bound estimate of the #of key-value pairs in the key range of the named index.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class AbstractKeyRangeIndexProcedure
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class AbstractKeyRangeIndexProcedure
Throws:
IOException


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.