1
0
Fork 0

handle calculated object elements in explain

This commit is contained in:
Jan Steemann 2015-05-26 21:20:43 +02:00
parent e9f704ff4e
commit d0b8af7c0b
4 changed files with 6 additions and 1 deletions

View File

@ -177,7 +177,7 @@ std::unordered_map<std::string, Function const> const Executor::FunctionNames{
// document functions
{ "HAS", Function("HAS", "AQL_HAS", "az,s", true, false, true, &Functions::Has) },
{ "ATTRIBUTES", Function("ATTRIBUTES", "AQL_ATTRIBUTES", "a|b,b", true, false, true) },
{ "ATTRIBUTES", Function("ATTRIBUTES", "AQL_ATTRIBUTES", "a|b,b", true, false, true, &Functions::Attributes) },
{ "VALUES", Function("VALUES", "AQL_VALUES", "a|b", true, false, true) },
{ "MERGE", Function("MERGE", "AQL_MERGE", "a,a|+", true, false, true, &Functions::Merge) },
{ "MERGE_RECURSIVE", Function("MERGE_RECURSIVE", "AQL_MERGE_RECURSIVE", "a,a|+", true, false, true) },

View File

@ -66,6 +66,7 @@ namespace triagens {
static AqlValue Keep (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Merge (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Has (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Attributes (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Min (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Max (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Sum (triagens::aql::Query*, triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);

View File

@ -327,6 +327,8 @@ function processQuery (query, explain) {
return "{ }";
case "object element":
return value(JSON.stringify(node.name)) + " : " + buildExpression(node.subNodes[0]);
case "calculated object element":
return "[ " + buildExpression(node.subNodes[0]) + " ] : " + buildExpression(node.subNodes[1]);
case "array":
if (node.hasOwnProperty("subNodes")) {
return "[ " + node.subNodes.map(buildExpression).join(", ") + " ]";

View File

@ -326,6 +326,8 @@ function processQuery (query, explain) {
return "{ }";
case "object element":
return value(JSON.stringify(node.name)) + " : " + buildExpression(node.subNodes[0]);
case "calculated object element":
return "[ " + buildExpression(node.subNodes[0]) + " ] : " + buildExpression(node.subNodes[1]);
case "array":
if (node.hasOwnProperty("subNodes")) {
return "[ " + node.subNodes.map(buildExpression).join(", ") + " ]";