mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'feature/parallel-aql-phase-one' of github.com:arangodb/arangodb into feature/parallel-aql-phase-one
This commit is contained in:
commit
5e0321900e
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue