mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'aql-jmmh-conditions' of github.com:arangodb/arangodb into aql-jmmh-conditions
This commit is contained in:
commit
3846c037da
|
@ -1827,6 +1827,9 @@ struct SortToIndexNode final : public WalkerWorker<ExecutionNode> {
|
||||||
auto numCovered = sortCondition.coveredAttributes(outVariable, index->fields);
|
auto numCovered = sortCondition.coveredAttributes(outVariable, index->fields);
|
||||||
|
|
||||||
if (numCovered == sortCondition.numAttributes()) {
|
if (numCovered == sortCondition.numAttributes()) {
|
||||||
|
std::unique_ptr<Condition> condition(new Condition(_plan->getAst()));
|
||||||
|
condition->normalize(_plan);
|
||||||
|
|
||||||
std::unique_ptr<ExecutionNode> newNode(new IndexNode(
|
std::unique_ptr<ExecutionNode> newNode(new IndexNode(
|
||||||
_plan,
|
_plan,
|
||||||
_plan->nextId(),
|
_plan->nextId(),
|
||||||
|
@ -1834,10 +1837,12 @@ struct SortToIndexNode final : public WalkerWorker<ExecutionNode> {
|
||||||
enumerateCollectionNode->collection(),
|
enumerateCollectionNode->collection(),
|
||||||
outVariable,
|
outVariable,
|
||||||
std::vector<Index const*>({ index }),
|
std::vector<Index const*>({ index }),
|
||||||
nullptr,
|
condition.get(),
|
||||||
sortCondition.isDescending()
|
sortCondition.isDescending()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
condition.release();
|
||||||
|
|
||||||
auto n = newNode.release();
|
auto n = newNode.release();
|
||||||
|
|
||||||
_plan->registerNode(n);
|
_plan->registerNode(n);
|
||||||
|
|
|
@ -847,14 +847,14 @@ IndexIterator* HashIndex::iteratorForCondition (IndexIteratorContext* context,
|
||||||
type = aql::NODE_TYPE_OPERATOR_BINARY_EQ;
|
type = aql::NODE_TYPE_OPERATOR_BINARY_EQ;
|
||||||
permutationStates.emplace_back(PermutationState(type, valNode, attributePosition, 1));
|
permutationStates.emplace_back(PermutationState(type, valNode, attributePosition, 1));
|
||||||
}
|
}
|
||||||
else if (valNode->numMembers() > 0) {
|
else {
|
||||||
|
if (valNode->numMembers() == 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
permutationStates.emplace_back(PermutationState(type, valNode, attributePosition, valNode->numMembers()));
|
permutationStates.emplace_back(PermutationState(type, valNode, attributePosition, valNode->numMembers()));
|
||||||
maxPermutations *= valNode->numMembers();
|
maxPermutations *= valNode->numMembers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permutationStates.empty()) {
|
if (permutationStates.empty()) {
|
||||||
|
@ -875,7 +875,7 @@ IndexIterator* HashIndex::iteratorForCondition (IndexIteratorContext* context,
|
||||||
|
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
auto state = permutationStates[i];
|
auto& state = permutationStates[i];
|
||||||
std::unique_ptr<TRI_json_t> json(state.getValue()->toJsonValue(TRI_UNKNOWN_MEM_ZONE));
|
std::unique_ptr<TRI_json_t> json(state.getValue()->toJsonValue(TRI_UNKNOWN_MEM_ZONE));
|
||||||
|
|
||||||
if (json == nullptr) {
|
if (json == nullptr) {
|
||||||
|
|
|
@ -1304,7 +1304,10 @@ IndexIterator* SkiplistIndex::iteratorForCondition (IndexIteratorContext* contex
|
||||||
if (isAttributeExpanded(usedFields)) {
|
if (isAttributeExpanded(usedFields)) {
|
||||||
permutationStates.emplace_back(PermutationState(aql::NODE_TYPE_OPERATOR_BINARY_EQ, value, usedFields, 1));
|
permutationStates.emplace_back(PermutationState(aql::NODE_TYPE_OPERATOR_BINARY_EQ, value, usedFields, 1));
|
||||||
}
|
}
|
||||||
else if (value->numMembers() > 0) {
|
else {
|
||||||
|
if (value->numMembers() == 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
permutationStates.emplace_back(PermutationState(comp->type, value, usedFields, value->numMembers()));
|
permutationStates.emplace_back(PermutationState(comp->type, value, usedFields, value->numMembers()));
|
||||||
maxPermutations *= value->numMembers();
|
maxPermutations *= value->numMembers();
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1390,8 @@ IndexIterator* SkiplistIndex::iteratorForCondition (IndexIteratorContext* contex
|
||||||
|
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
for (size_t i = 0; i < usedFields; ++i) {
|
for (size_t i = 0; i < usedFields; ++i) {
|
||||||
auto state = permutationStates[i];
|
TRI_ASSERT(i < permutationStates.size());
|
||||||
|
auto& state = permutationStates[i];
|
||||||
std::unique_ptr<TRI_json_t> json(state.getValue()->toJsonValue(TRI_UNKNOWN_MEM_ZONE));
|
std::unique_ptr<TRI_json_t> json(state.getValue()->toJsonValue(TRI_UNKNOWN_MEM_ZONE));
|
||||||
|
|
||||||
if (json == nullptr) {
|
if (json == nullptr) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ function runJSUnityTests(tests) {
|
||||||
require("fs").write("testresult.json", JSON.stringify(allResults));
|
require("fs").write("testresult.json", JSON.stringify(allResults));
|
||||||
|
|
||||||
if (failed.length > 1) {
|
if (failed.length > 1) {
|
||||||
print("The following test files produced errors: ", failed.join(", "));
|
print("The following " + failed.length + " test files produced errors: ", failed.join(", "));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue