1
0
Fork 0

Merge branch 'feature/parallel-aql-phase-one' of github.com:arangodb/arangodb into feature/parallel-aql-phase-one

This commit is contained in:
Simon Grätzer 2019-10-29 11:47:13 +01:00
commit 5e0321900e
No known key found for this signature in database
GPG Key ID: E4736AA091116E5C
2 changed files with 14 additions and 6 deletions

View File

@ -63,14 +63,14 @@ namespace {
arangodb::velocypack::StringRef const SortModeUnset("unset");
arangodb::velocypack::StringRef const SortModeMinElement("minelement");
arangodb::velocypack::StringRef const SortModeHeap("heap");
std::map<arangodb::velocypack::StringRef, GatherNode::SortMode> const NameToValue{
{SortModeMinElement, GatherNode::SortMode::MinElement},
{SortModeHeap, GatherNode::SortMode::Heap},
{SortModeUnset, GatherNode::SortMode::Default}};
bool toSortMode(arangodb::velocypack::StringRef const& str, GatherNode::SortMode& mode) noexcept {
// std::map ~25-30% faster than std::unordered_map for small number of elements
static std::map<arangodb::velocypack::StringRef, GatherNode::SortMode> const NameToValue{
{SortModeMinElement, GatherNode::SortMode::MinElement},
{SortModeHeap, GatherNode::SortMode::Heap},
{SortModeUnset, GatherNode::SortMode::Default}};
auto const it = NameToValue.find(str);
if (it == NameToValue.end()) {

View File

@ -1649,12 +1649,20 @@ function processQuery(query, explain, planIndex) {
case 'ScatterNode':
return keyword('SCATTER');
case 'GatherNode':
let gatherAnnotations = [];
if (node.isParallelizable) {
gatherAnnotations.push('parallel');
}
if (node.sortmode !== 'unset') {
gatherAnnotations.push('sort mode: ' + node.sortmode);
}
return keyword('GATHER') + ' ' + node.elements.map(function (node) {
if (node.path && node.path.length) {
return variableName(node.inVariable) + node.path.map(function (n) { return '.' + attribute(n); }) + ' ' + keyword(node.ascending ? 'ASC' : 'DESC');
}
return variableName(node.inVariable) + ' ' + keyword(node.ascending ? 'ASC' : 'DESC');
}).join(', ') + (node.sortmode === 'unset' ? '' : ' ' + annotation('/* sort mode: ' + node.sortmode + ' */'));
}).join(', ') + (gatherAnnotations.length ? ' ' + annotation('/* ' + gatherAnnotations.join(', ') + ' */') : '');
case 'MaterializeNode':
return keyword('MATERIALIZE') + ' ' + variableName(node.outVariable);
}