1
0
Fork 0

Bug fix/3.2.1 issues (#3009)

* fix documentation

* fix crash in explain
This commit is contained in:
Jan 2017-08-09 16:49:24 +02:00 committed by Frank Celler
parent 345ebe1414
commit 0238d651fb
7 changed files with 35 additions and 12 deletions

View File

@ -40,7 +40,8 @@ Returns the vertex defined with the attribute *_from* of the edge with *edgeId*
@EXAMPLE_ARANGOSH_OUTPUT{generalGraphGetFromVertex}
var examples = require("@arangodb/graph-examples/example-graph.js");
var graph = examples.loadGraph("social");
graph._fromVertex("relation/aliceAndBob")
var any = require("@arangodb").db.relation.any();
graph._fromVertex("relation/" + any._key);
~ examples.dropGraph("social");
@END_EXAMPLE_ARANGOSH_OUTPUT
@endDocuBlock generalGraphGetFromVertex
@ -71,7 +72,8 @@ Returns the vertex defined with the attribute *_to* of the edge with *edgeId* as
@EXAMPLE_ARANGOSH_OUTPUT{generalGraphGetToVertex}
var examples = require("@arangodb/graph-examples/example-graph.js");
var graph = examples.loadGraph("social");
graph._toVertex("relation/aliceAndBob")
var any = require("@arangodb").db.relation.any();
graph._toVertex("relation/" + any._key);
~ examples.dropGraph("social");
@END_EXAMPLE_ARANGOSH_OUTPUT
@endDocuBlock generalGraphGetToVertex

View File

@ -50,7 +50,8 @@ Returned if if-match header is given, but the documents revision is different.
var examples = require("@arangodb/graph-examples/example-graph.js");
~ examples.dropGraph("social");
examples.loadGraph("social");
var url = "/_api/gharial/social/edge/relation/aliceAndBob";
var any = require("@arangodb").db.relation.any();
var url = "/_api/gharial/social/edge/relation/" + any._key;
var response = logCurlRequest('DELETE', url);
assert(response.code === 202);

View File

@ -42,7 +42,8 @@ Returned if if-match header is given, but the documents revision is different.
var examples = require("@arangodb/graph-examples/example-graph.js");
~ examples.dropGraph("social");
examples.loadGraph("social");
var url = "/_api/gharial/social/edge/relation/aliceAndBob";
var any = require("@arangodb").db.relation.any();
var url = "/_api/gharial/social/edge/relation/" + any._key;
var response = logCurlRequest('GET', url);
assert(response.code === 200);

View File

@ -46,12 +46,12 @@ Returned if no graph with this name, no edge collection or no edge with this id
var examples = require("@arangodb/graph-examples/example-graph.js");
~ examples.dropGraph("social");
examples.loadGraph("social");
var url = "/_api/gharial/social/edge/relation/aliceAndBob";
var any = require("@arangodb").db.relation.any();
var url = "/_api/gharial/social/edge/relation/" + any._key;
body = {
since: "01.01.2001"
}
var response = logCurlRequest('PATCH', url, body);
assert(response.code === 202);
logJsonResponse(response);

View File

@ -52,7 +52,8 @@ Returned if if-match header is given, but the documents revision is different.
var examples = require("@arangodb/graph-examples/example-graph.js");
~ examples.dropGraph("social");
examples.loadGraph("social");
var url = "/_api/gharial/social/edge/relation/aliceAndBob";
var any = require("@arangodb").db.relation.any();
var url = "/_api/gharial/social/edge/relation/" + any._key;
body = {
type: "divorced",
_from: "female/alice",

View File

@ -948,12 +948,9 @@ QueryResult Query::explain() {
// put in bind parameters
parser.ast()->injectBindParameters(_bindParameters);
enterState(QueryExecutionState::ValueType::AST_OPTIMIZATION);
// optimize and validate the ast
parser.ast()->validateAndOptimize();
enterState(QueryExecutionState::ValueType::AST_OPTIMIZATION);
enterState(QueryExecutionState::ValueType::LOADING_COLLECTIONS);
// create the transaction object, but do not start it yet
_trx = new AqlTransaction(createTransactionContext(),
_collections.collections(),
@ -965,6 +962,10 @@ QueryResult Query::explain() {
if (!res.ok()) {
THROW_ARANGO_EXCEPTION(res);
}
enterState(QueryExecutionState::ValueType::LOADING_COLLECTIONS);
parser.ast()->validateAndOptimize();
enterState(QueryExecutionState::ValueType::PLAN_INSTANTIATION);
ExecutionPlan* plan = ExecutionPlan::instantiateFromAst(parser.ast());

View File

@ -455,8 +455,25 @@ function ExplainSuite () {
node = nodes[2];
assertEqual("ReplaceNode", node.type);
assertEqual(cn, node.collection);
}
},
testV8Query : function () {
// should not crash the server
var st = new ArangoStatement(db, { query : "FOR i IN [ 1, 2, 3 ] FILTER 1 == 2 RETURN i" });
var nodes = st.explain().plan.nodes, node;
node = nodes[0];
assertEqual("SingletonNode", node.type);
},
testV8QueryWithFCall : function () {
// should not crash the server either
var st = new ArangoStatement(db, { query : "FOR i IN [ 1, 2, 3 ] FILTER V8(TO_STRING(i)) == '1' RETURN i" });
var nodes = st.explain().plan.nodes, node;
node = nodes[0];
assertEqual("SingletonNode", node.type);
}
};
}