1
0
Fork 0
This commit is contained in:
Jan 2019-10-21 15:06:03 +02:00 committed by KVS85
parent 55ca6c8660
commit 4290f381af
3 changed files with 25 additions and 18 deletions

View File

@ -1,6 +1,8 @@
v3.5.2 (XXXX-XX-XX)
-------------------
* Fixed issue #10270: Query: Expecting type Array or Object (while executing).
* Fix a problem with AQL constrained sort in the cluster, which might abort
queries. The AQL sort-limit optimization rule may now also speed up fullCount
with sorted indexes and a limit in the cluster.
@ -9,8 +11,8 @@ v3.5.2 (XXXX-XX-XX)
x s" from occurring when this is not the case. Due to a data race, the
message could previously also occur if the queue was empty.
* The General Graph document API is now persistent with the document API in its
errormessages. When attempting to create / modify edges pointing to non
* The General Graph document API is now consistent with the document API in its
error messages. When attempting to create / modify edges pointing to non
existing vertex collections HTTP 400 is returned instead of 404.
* Disallow the usage of subqueries inside AQL traversal PRUNE conditions.

View File

@ -38,6 +38,17 @@
using namespace arangodb;
using namespace arangodb::aql;
namespace {
void throwArrayExpectedException(AqlValue const& value) {
THROW_ARANGO_EXCEPTION_MESSAGE(
TRI_ERROR_QUERY_ARRAY_EXPECTED,
std::string("collection or ") + TRI_errno_string(TRI_ERROR_QUERY_ARRAY_EXPECTED) +
std::string(
" as operand to FOR loop; you provided a value of type '") +
value.getTypeString() + std::string("'"));
}
} // namespace
EnumerateListExecutorInfos::EnumerateListExecutorInfos(
RegisterId inputRegister, RegisterId outputRegister,
RegisterId nrInputRegisters, RegisterId nrOutputRegisters,
@ -65,7 +76,6 @@ std::pair<ExecutionState, NoStats> EnumerateListExecutor::produceRows(OutputAqlI
// HIT in first run, because pos and length are initiliazed
// both with 0
// if (_inputArrayPosition == _inputArrayLength || _inputArrayPosition == _inputArrayLength - 1) {
if (_inputArrayPosition == _inputArrayLength) {
// we need to set position back to zero
// because we finished iterating over existing array
@ -94,6 +104,9 @@ std::pair<ExecutionState, NoStats> EnumerateListExecutor::produceRows(OutputAqlI
if (inputList.isDocvec()) {
_inputArrayLength = inputList.docvecSize();
} else {
if (!inputList.isArray()) {
throwArrayExpectedException(inputList);
}
_inputArrayLength = inputList.length();
}
}

View File

@ -41,20 +41,6 @@ var assertQueryError = helper.assertQueryError;
function ahuacatlQuerySimpleTestSuite () {
return {
////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
},
////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
},
testNoArraySorting1 : function () {
let query = "LET values = [9,16,8,15,7,14,6,13,5,12,4,11,3,10,2,1] RETURN values";
assertEqual([9, 16, 8, 15, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 1], AQL_EXECUTE(query).json[0]);
@ -1338,7 +1324,13 @@ function ahuacatlQuerySimpleTestSuite () {
var actual = getQueryResults(query[0]);
assertEqual(query[1], actual);
});
}
},
testForWithoutArray : function () {
assertQueryError(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "LET a = null FOR x IN a RETURN 1");
assertQueryError(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "LET a = NOOPT(null) FOR x IN a RETURN 1");
},
};
}