8000 Fix explainer output when restricting collections (#11338) · arangodb/arangodb@e5bcd44 · GitHub
[go: up one dir, main page]

Skip to content

Commit e5bcd44

Browse files
author
Dan Larkin-York
authored
Fix explainer output when restricting collections (#11338)
1 parent 938f1a4 commit e5bcd44

File tree

1 file changed

+143
-43
lines changed

1 file changed

+143
-43
lines changed

js/common/modules/@arangodb/aql/explainer.js

Lines changed: 143 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,6 @@ function printTraversalDetails(traversals) {
507507
uniqueVertices: options.uniqueVertices,
508508
uniqueEdges: options.uniqueEdges
509509
};
510-
if (options.vertexCollections !== undefined) {
511-
opts.vertexCollections = options.vertexCollections;
512-
}
513510

514511
var result = '';
515512
for (var att in opts) {
@@ -1103,7 +1100,7 @@ function processQuery(query, explain, planIndex) {
11031100
};
11041101

11051102
var label = function (node) {
1106-
var rc, v, e, edgeCols, i, d, directions, isLast;
1103+
var rc, v, vNames, e, eNames, edgeCols, i, d, directions, isLast;
11071104
var parts = [];
11081105
var types = [];
11091106
var filter = '';
@@ -1296,27 +1293,62 @@ function processQuery(query, explain, planIndex) {
12961293
}
12971294

12981295
e = [];
1296+
eNames = [];
12991297
if (node.hasOwnProperty('graphDefinition')) {
13001298
v = [];
1301-
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1302-
v.push(collection(vcn));
1303-
});
1299+
vNames = [];
1300+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1301+
node.options.vertexCollections.forEach(function (vcn) {
1302+
v.push(collection(vcn));
1303+
vNames.push(vcn);
1304+
});
1305+
} else {
1306+
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1307+
v.push(collection(vcn));
1308+
vNames.push(vcn);
1309+
});
1310+
}
13041311
node.vertexCollectionNameStr = v.join(', ');
1305-
node.vertexCollectionNameStrLen = node.graphDefinition.vertexCollectionNames.join(', ').length;
1312+
node.vertexCollectionNameStrLen = vNames.join(', ').length;
13061313

1307-
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1308-
e.push(collection(ecn));
1309-
});
1314+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1315+
node.options.edgeCollections.forEach(function (ecn) {
1316+
e.push(collection(ecn));
1317+
eNames.push(ecn);
1318+
});
1319+
} else {
1320+
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1321+
e.push(collection(ecn));
1322+
eNames.push(ecn);
1323+
});
1324+
}
13101325
node.edgeCollectionNameStr = e.join(', ');
1311-
node.edgeCollectionNameStrLen = node.graphDefinition.edgeCollectionNames.join(', ').length;
1326+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
13121327
} else {
1313-
edgeCols = node.graph || [];
1314-
edgeCols.forEach(function (ecn) {
1315-
e.push(collection(ecn));
1316-
});
1328+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1329+
node.options.edgeCollections.forEach(function (ecn) {
1330+
e.push(collection(ecn));
1331+
eNames.push(ecn);
1332+
});
1333+
} else {
1334+
edgeCols = node.graph || [];
1335+
edgeCols.forEach(function (ecn) {
1336+
e.push(collection(ecn));
1337+
eNames.push(ecn);
1338+
});
1339+
}
13171340
node.edgeCollectionNameStr = e.join(', ');
1318-
node.edgeCollectionNameStrLen = edgeCols.join(', ').length;
1341+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
13191342
node.graph = '<anonymous>';
1343+
1344+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1345+
v = [];
1346+
node.options.vertexCollections.forEach(function (vcn) {
1347+
v.push(collection(vcn));
1348+
});
1349+
node.vertexCollectionNameStr = v.join(', ');
1350+
node.vertexCollectionNameStrLen = node.options.vertexCollections.join(', ').length;
1351+
}
13201352
}
13211353

13221354
allIndexes.forEach(function (idx) {
@@ -1374,27 +1406,61 @@ function processQuery(query, explain, planIndex) {
13741406

13751407
shortestPathDetails.push(node);
13761408
e = [];
1409+
eNames = [];
13771410
if (node.hasOwnProperty('graphDefinition')) {
13781411
v = [];
1379-
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1380-
v.push(collection(vcn));
1381-
});
1412+
vNames = [];
1413+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1414+
node.options.vertexCollections.forEach(function (vcn) {
1415+
v.push(collection(vcn));
1416+
vNames.push(vcn);
1417+
});
1418+
} else {
1419+
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1420+
v.push(collection(vcn));
1421+
vNames.push(vcn);
1422+
});
1423+
}
13821424
node.vertexCollectionNameStr = v.join(', ');
1383-
node.vertexCollectionNameStrLen = node.graphDefinition.vertexCollectionNames.join(', ').length;
1425+
node.vertexCollectionNameStrLen = vNames.join(', ').length;
13841426

1385-
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1386-
e.push(collection(ecn));
1387-
});
1427+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1428+
node.options.edgeCollections.forEach(function (ecn) {
1429+
e.push(collection(ecn));
1430+
eNames.push(ecn);
1431+
});
1432+
} else {
1433+
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1434+
e.push(collection(ecn));
1435+
eNames.push(ecn);
1436+
});
1437+
}
13881438
node.edgeCollectionNameStr = e.join(', ');
1389-
node.edgeCollectionNameStrLen = node.graphDefinition.edgeCollectionNames.join(', ').length;
1439+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
13901440
} else {
1391-
edgeCols = node.graph || [];
1392-
edgeCols.forEach(function (ecn) {
1393-
e.push(collection(ecn));
1394-
});
1441+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1442+
node.options.edgeCollections.forEach(function (ecn) {
1443+
e.push(collection(ecn));
1444+
eNames.push(ecn);
1445+
});
1446+
} else {
1447+
edgeCols = node.graph || [];
1448+
edgeCols.forEach(function (ecn) {
1449+
e.push(collection(ecn));
1450+
eNames.push(ecn);
1451+
});
1452+
}
13951453
node.edgeCollectionNameStr = e.join(', ');
1396-
node.edgeCollectionNameStrLen = edgeCols.join(', ').length;
1454+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
13971455
node.graph = '<anonymous>';
1456+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1457+
v = [];
1458+
node.options.vertexCollections.forEach(function (vcn) {
1459+
v.push(collection(vcn));
1460+
});
1461+
node.vertexCollectionNameStr = v.join(', ');
1462+
node.vertexCollectionNameStrLen = node.options.vertexCollections.join(', ').length;
1463+
}
13981464
}
13991465
return rc;
14001466
}
@@ -1445,27 +1511,61 @@ function processQuery(query, explain, planIndex) {
14451511

14461512
kShortestPathsDetails.push(node);
14471513
e = [];
1514+
eNames = [];
14481515
if (node.hasOwnProperty('graphDefinition')) {
14491516
v = [];
1450-
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1451-
v.push(collection(vcn));
1452-
});
1517+
vNames = [];
1518+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1519+
node.options.vertexCollections.forEach(function (vcn) {
1520+
v.push(collection(vcn));
1521+
vNames.push(vcn);
1522+
});
1523+
} else {
1524+
node.graphDefinition.vertexCollectionNames.forEach(function (vcn) {
1525+
v.push(collection(vcn));
1526+
vNames.push(vcn);
1527+
});
1528+
}
14531529
node.vertexCollectionNameStr = v.join(', ');
1454-
node.vertexCollectionNameStrLen = node.graphDefinition.vertexCollectionNames.join(', ').length;
1530+
node.vertexCollectionNameStrLen = vNames.join(', ').length;
14551531

1456-
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1457-
e.push(collection(ecn));
1458-
});
1532+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1533+
node.options.edgeCollections.forEach(function (ecn) {
1534+
e.push(collection(ecn));
1535+
eNames.push(ecn);
1536+
});
1537+
} else {
1538+
node.graphDefinition.edgeCollectionNames.forEach(function (ecn) {
1539+
e.push(collection(ecn));
1540+
eNames.push(ecn);
1541+
});
1542+
}
14591543
node.edgeCollectionNameStr = e.join(', ');
1460-
node.edgeCollectionNameStrLen = node.graphDefinition.edgeCollectionNames.join(', ').length;
1544+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
14611545
} else {
1462-
edgeCols = node.graph || [];
1463-
edgeCols.forEach(function (ecn) {
1464-
e.push(collection(ecn));
1465-
});
1546+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('edgeCollections')) {
1547+
node.options.edgeCollections.forEach(function (ecn) {
1548+
e.push(collection(ecn));
1549+
eNames.push(ecn);
1550+
});
1551+
} else {
1552+
edgeCols = node.graph || [];
1553+
edgeCols.forEach(function (ecn) {
1554+
e.push(collection(ecn));
1555+
eNames.push(ecn);
1556+
});
1557+
}
14661558
node.edgeCollectionNameStr = e.join(', ');
1467-
node.edgeCollectionNameStrLen = edgeCols.join(', ').length;
1559+
node.edgeCollectionNameStrLen = eNames.join(', ').length;
14681560
node.graph = '<anonymous>';
1561+
if (node.hasOwnProperty('options') && node.options.hasOwnProperty('vertexCollections')) {
1562+
v = [];
1563+
node.options.vertexCollections.forEach(function (vcn) {
1564+
v.push(collection(vcn));
1565+
});
1566+
node.vertexCollectionNameStr = v.join(', ');
1567+
node.vertexCollectionNameStrLen = node.options.vertexCollections.join(', ').length;
1568+
}
14691569
}
14701570
return rc;
14711571
}

0 commit comments

Comments
 (0)
0