1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Willi Goesgens 2014-10-02 11:08:02 +02:00
commit d7d6ce65db
3 changed files with 45 additions and 5 deletions

View File

@ -3638,6 +3638,36 @@ bool ScatterBlock::hasMore () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief remainingForShard: remaining for shard, sum of the number of row left
/// in the buffer and _dependencies[0]->remaining()
////////////////////////////////////////////////////////////////////////////////
int64_t ScatterBlock::remainingForShard (std::string const& shardId) {
size_t clientId = getClientId(shardId);
if (_doneForClient.at(clientId)) {
return 0;
}
int64_t sum = _dependencies[0]->remaining();
if (sum == -1) {
return -1;
}
std::pair<size_t,size_t> pos = _posForClient.at(clientId);
if (pos.first <= _buffer.size()) {
sum += _buffer.at(pos.first)->size() - pos.second;
for (auto i = pos.first + 1; i < _buffer.size(); i++) {
sum += _buffer.at(i)->size();
}
}
return sum;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief hasMoreForShard: any more for shard <shardId>?
////////////////////////////////////////////////////////////////////////////////

View File

@ -1574,7 +1574,7 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
int64_t remaining () {
return _dependencies[0]->remaining();
TRI_ASSERT(false);
}
////////////////////////////////////////////////////////////////////////////////
@ -1606,6 +1606,12 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
bool hasMoreForShard (std::string const& shardId);
////////////////////////////////////////////////////////////////////////////////
/// @brief remainingForShard: remaining for shard <shardId>?
////////////////////////////////////////////////////////////////////////////////
int64_t remainingForShard (std::string const& shardId);
////////////////////////////////////////////////////////////////////////////////
/// @brief getOrSkipSomeForShard

View File

@ -1998,6 +1998,7 @@ class RemoveToEnumCollFinder: public WalkerWorker<ExecutionNode> {
}
bool before (ExecutionNode* en) {
std::cout << "before!\n";
switch (en->getType()) {
case EN::REMOVE:{
TRI_ASSERT(_remove == false);
@ -2013,10 +2014,10 @@ class RemoveToEnumCollFinder: public WalkerWorker<ExecutionNode> {
_variable = varsToRemove[0]; // the variable we'll remove
auto _enumColl = static_cast<EnumerateCollectionNode*>(_plan->getVarSetBy(_variable->id));
if (_enumColl == nullptr
|| _enumColl->getType() != triagens::aql::ExecutionNode::ENUMERATE_COLLECTION
|| _enumColl->collection()->cid() != rn->collection()->cid() ) {
|| _enumColl->getType() != triagens::aql::ExecutionNode::ENUMERATE_COLLECTION ) {
// || _enumColl->collection()->cid() != rn->collection()->cid() ) {
// remove variable was not introduced by an enumerate collection or
// it was but the collections differ
break; // abort . . .
@ -2057,6 +2058,10 @@ class RemoveToEnumCollFinder: public WalkerWorker<ExecutionNode> {
_toUnlink.insert(en);
return false; // continue . . .
}
case EN::CALCULATION: {//Check this is the calculation node of one of the filter nodes!
}
case EN::ENUMERATE_COLLECTION: {
// check that we are enumerating the variable we are to remove
if (en->id() != _enumColl->id()) {
@ -2067,7 +2072,6 @@ class RemoveToEnumCollFinder: public WalkerWorker<ExecutionNode> {
}
case EN::SINGLETON:
case EN::CALCULATION:
case EN::ENUMERATE_LIST:
case EN::SUBQUERY:
case EN::AGGREGATE: