Fennel: ExternalSortMerger Class Reference (original) (raw)

ExternalSortMerger manages the process of merging stored runs. More...

#include <[ExternalSortMerger.h](ExternalSortMerger%5F8h-source.html)>

Inheritance diagram for ExternalSortMerger:

List of all members.

Public Member Functions
ExternalSortMerger (ExternalSortInfo &info)
virtual ~ExternalSortMerger ()
void initRunAccess ()
Initializes state used to access stored runs.
void startMerge (std::vector< SharedSegStreamAllocation >::iterator pStoredRun, uint nRunsToMerge)
Begins merge.
void releaseResources ()
Releases any resources acquired by this merger.
virtual ExternalSortFetchArray & bindFetchArray ()
Binds the fetch array which will be used implicitly by subsequent calls to fetch().
virtual ExternalSortRC fetch (uint nTuplesRequested)
Fetches tuples via the previously bound fetch array.
Private Member Functions
uint heapParent (uint i)
uint heapLeft (uint i)
uint heapRight (uint i)
void heapExchange (uint i, uint j)
void heapify (uint i)
void heapBuild ()
ExternalSortRC checkFetch ()
ExternalSortMergeInfo & getMergeHigh ()
Private Attributes
ExternalSortInfo & sortInfo
Global information.
boost::scoped_array< SharedExternalSortRunAccessor > ppRunAccessors
Array of accessors for runs to be merged.
boost::scoped_array< ExternalSortFetchArray * > ppFetchArrays
Array of fetch bindings corresponding to ppRunAccessors.
boost::scoped_array< uint > pOrds
Array of something-or-others corresponding to ppRunAccessors.
uint nMergeMemPages
Number of memory pages available for merging.
uint nRuns
Number of runs being merged.
boost::scoped_array< ExternalSortMergeInfo > mergeInfo
Array of info on runs being merged.
ExternalSortFetchArray fetchArray
Array used to return fetch results.
PBuffer ppTupleBuffers [EXTSORT_FETCH_ARRAY_SIZE]
Pointer array used to return fetch results.
TupleAccessor tupleAccessor
TupleAccessor tupleAccessor2
TupleProjectionAccessor keyAccessor
TupleProjectionAccessor keyAccessor2
TupleData keyData
TupleData keyData2

Detailed Description

ExternalSortMerger manages the process of merging stored runs.

Definition at line 63 of file ExternalSortMerger.h.


Constructor & Destructor Documentation

Definition at line 32 of file ExternalSortMerger.cpp.

References TupleProjectionAccessor::bind(), TupleData::compute(), TupleAccessor::compute(), fetchArray, keyAccessor, keyAccessor2, keyData, keyData2, ExternalSortInfo::keyDesc, ExternalSortInfo::keyProj, mergeInfo, nMergeMemPages, nRuns, ExternalSortInfo::nSortMemPages, pOrds, ppFetchArrays, ppRunAccessors, ppTupleBuffers, ExternalSortFetchArray::ppTupleBuffers, sortInfo, tupleAccessor, tupleAccessor2, and ExternalSortInfo::tupleDesc.

| ExternalSortMerger::~ExternalSortMerger | ( | | ) | [virtual] | | ---------------------------------------- | - | | - | ----------- |


Member Function Documentation

uint ExternalSortMerger::heapParent ( uint i ) [inline, private]
uint ExternalSortMerger::heapLeft ( uint i ) [inline, private]
uint ExternalSortMerger::heapRight ( uint i ) [inline, private]
void ExternalSortMerger::heapExchange ( uint i,
uint j
) [inline, private]
void ExternalSortMerger::heapify ( uint i ) [private]

Definition at line 135 of file ExternalSortMerger.cpp.

References ExternalSortInfo::compareKeys(), heapExchange(), heapLeft(), heapRight(), keyAccessor, keyAccessor2, keyData, keyData2, mergeInfo, nRuns, TupleAccessor::setCurrentTupleBuf(), sortInfo, tupleAccessor, tupleAccessor2, and TupleProjectionAccessor::unmarshal().

Referenced by fetch(), and heapBuild().

| void ExternalSortMerger::heapBuild | ( | | ) | [private] | | ---------------------------------- | - | | - | ----------- |

| void ExternalSortMerger::initRunAccess | ( | | ) | | -------------------------------------- | - | | - |

| void ExternalSortMerger::releaseResources | ( | | ) | | ----------------------------------------- | - | | - |

Fetches tuples via the previously bound fetch array.

Parameters:

nTuplesRequested maximum number of tuples to be returned from fetch (actual count may be less at callee's discretion; this does not indicate end of stream)

Returns:

result of fetch (either EXTSORT_ENDOFDATA or EXTSORT_SUCCESS)

Implements ExternalSortSubStream.

Definition at line 199 of file ExternalSortMerger.cpp.

References ExecStream::checkAbort(), checkFetch(), EXTSORT_FETCH_ARRAY_SIZE, EXTSORT_SUCCESS, fetchArray, getMergeHigh(), heapify(), ExternalSortFetchArray::nTuples, pOrds, ppFetchArrays, ExternalSortFetchArray::ppTupleBuffers, ExternalSortMergeInfo::runOrd, sortInfo, ExternalSortInfo::stream, and ExternalSortMergeInfo::val.


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:32 2009 for Fennel by doxygen 1.5.1