1
0
Fork 0

hash indexes working.

This commit is contained in:
James 2014-11-13 08:37:52 +00:00
parent f797afe0d5
commit a5006b7617
2 changed files with 16 additions and 10 deletions

View File

@ -850,9 +850,10 @@ IndexRangeBlock::IndexRangeBlock (ExecutionEngine* engine,
_collection(en->collection()),
_posInDocs(0),
_allBoundsConstant(true),
_skiplistIterator(nullptr){
_skiplistIterator(nullptr),
_condition(&en->_ranges) {
std::vector<std::vector<RangeInfo>> const& orRanges = en->_ranges;
std::vector<std::vector<RangeInfo>> const& orRanges = en->_ranges;//TODO replace this with _condition
TRI_ASSERT(en->_index != nullptr);
TRI_ASSERT(orRanges.size() == 1); // OR expressions not yet implemented
@ -944,7 +945,7 @@ int IndexRangeBlock::initialize () {
bool IndexRangeBlock::initIndex () {
auto en = static_cast<IndexRangeNode const*>(getPlanNode());
IndexOrCondition const* condition = &en->_ranges;
//IndexOrCondition const* _condition = &en->_ranges;
TRI_ASSERT(en->_index != nullptr);
@ -1040,7 +1041,7 @@ bool IndexRangeBlock::initIndex () {
newCondition.get()->at(0).push_back(actualRange);
}
condition = newCondition.get();
_condition = newCondition.get();
}
/*if (en->_index->type == TRI_IDX_TYPE_PRIMARY_INDEX) {
@ -1051,7 +1052,7 @@ bool IndexRangeBlock::initIndex () {
return true; //no initialization here!
}
if (en->_index->type == TRI_IDX_TYPE_SKIPLIST_INDEX) {
initSkiplistIndex(*condition);
initSkiplistIndex(*_condition);
return (_skiplistIterator != nullptr);
}/*
else if (en->_index->type == TRI_IDX_TYPE_EDGE_INDEX) {
@ -1083,14 +1084,13 @@ bool IndexRangeBlock::readIndex (size_t atMost) {
}
auto en = static_cast<IndexRangeNode const*>(getPlanNode());
IndexOrCondition const* condition = &en->_ranges; //TODO remove this line
if (en->_index->type == TRI_IDX_TYPE_PRIMARY_INDEX) {
// atMost not passed since only equality is supported
//readPrimaryIndex(*condition); //TODO correct
}
else if (en->_index->type == TRI_IDX_TYPE_HASH_INDEX) {
readHashIndex(*condition, atMost);
readHashIndex(*_condition, atMost);
}
else if (en->_index->type == TRI_IDX_TYPE_SKIPLIST_INDEX) {
readSkiplistIndex(atMost);
@ -1210,7 +1210,10 @@ AqlItemBlock* IndexRangeBlock::getSome (size_t atLeast,
_pos = 0;
}
if (! _buffer.empty()) {
initIndex();
if(! initIndex()) {//FIXME is this right?
_done = true;
return nullptr;
}
readIndex(atMost);
}
// If _buffer is empty, then we will fetch a new block in the next call
@ -1414,7 +1417,6 @@ void IndexRangeBlock::readHashIndex (IndexOrCondition const& ranges, size_t atMo
setupSearchValue();
TRI_index_result_t list = TRI_LookupHashIndex(idx, &searchValue);
destroySearchValue();
size_t const n = list._length;
_posInHashIndex += n;

View File

@ -637,7 +637,7 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
/// @brief _inVars, a vector containing for each expression above
/// a vector of Variable*, used to execute the expression
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
std::vector<std::vector<Variable*>> _inVars;
@ -649,8 +649,12 @@ namespace triagens {
std::vector<std::vector<RegisterId>> _inRegs;
TRI_skiplist_iterator_t* _skiplistIterator;
size_t _posInHashIndex;
// condition for current incoming block
IndexOrCondition const* _condition;
};
// -----------------------------------------------------------------------------