1
0
Fork 0

fix internal issue #1848 (#4521)

AQL optimizer was trying to resolve attribute accesses
to attributes of constant object values at query compile time, but only did so far
the very first attribute in each object

this fixes https://stackoverflow.com/questions/48648737/beginner-bug-in-for-loops-from-objects
This commit is contained in:
Jan 2018-02-08 09:23:15 +01:00 committed by GitHub
parent a7ee38b5fa
commit 0eae1d225f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 37 deletions

View File

@ -15,15 +15,10 @@ devel
superseded by other REST APIs and were partially dysfunctional. Therefore
these two endpoints have been removed entirely.
* fix issue #4272: VERSION file keeps disappearing
* fix internal issue #81: quotation marks disappeared when switching table/json
editor in the query editor ui
* fixed issue #1532: reload users on restore
* fixed internal issue #1475: when restoring a cluster dump to a single server
ignore indices of type primary and edge since we mustn't create them here.
ignore indexes of type primary and edge since we mustn't create them here.
* fix internal issue 1770: collection creation using distributeShardsLike yields
errors and did not distribute shards correctly in the following cases:
@ -39,7 +34,7 @@ devel
instead of replacing them.
* fixed: Foxx upload of single javascript file. You now can upload via http-url pointing
to a javascript file.
to a JavaScript file.
* fixed issue #4395: If your foxx app includes an `APP` folder it got accidently removed by selfhealing
this is not the case anymore.
@ -50,38 +45,11 @@ devel
Write-throttling is turned on by default, to reduce chances of compactions getting
too far behind and blocking incoming writes.
* fixed issue #4308: Crash when getter for error.name throws an error (on Windows)
* UI: fixed an issue where a collection name gets wrongly cached within the
documents overview of a collection.
* UI: fixed a query editor caching and parsing issue
* issue #4222: Permission error preventing AQL query import / export on webui
* Fixed an issue with the index estimates in RocksDB in the case a transaction is aborted.
Former the index estimates were modified if the transaction commited or not.
Now they will only be modified if the transaction commited successfully.
* UI: optimized login view for very small screen sizes
* UI: optimized error messages for invalid query bind parameter
* Truncate in RocksDB will now do intermediate commits every 10.000 documents
if truncate fails or the server crashes during this operation all deletes
that have been commited so far are persisted.
* make the default value of `--rocksdb.block-cache-shard-bits` use the RocksDB
default value. This will mostly mean the default number block cache shard
bits is lower than before, allowing each shard to store more data and cause
less evictions from block cache
* Updated Swagger UI to version 3.9.0
* issue #1190: added option `--create-database` for arangoimport
* issue #3504: added option `--force-same-database` for arangorestore
with this option set to true, it is possible to make any arangorestore attempt
fail if the specified target database does not match the database name
specified in the source dump's "dump.json" file. it can thus be used to
@ -131,11 +99,64 @@ devel
Health did not function for multiple servers at the same time, as
agency transaction was malformed.
v3.3.3 (XXXX-XX-XX)
v3.3.3 (2018-01-16)
-------------------
* fix issue #4272: VERSION file keeps disappearing
* fix internal issue #81: quotation marks disappeared when switching table/json
editor in the query editor ui
* added option `--rocksdb.throttle` to control whether write-throttling is enabled
Write-throttling is turned on by default, to reduce chances of compactions getting
too far behind and blocking incoming writes.
* fixed issue #4308: Crash when getter for error.name throws an error (on Windows)
* UI: fixed a query editor caching and parsing issue
* Fixed internal issue #1683: fixes an UI issue where a collection name gets wrongly cached
within the documents overview of a collection.
* Fixed an issue with the index estimates in RocksDB in the case a transaction is aborted.
Former the index estimates were modified if the transaction commited or not.
Now they will only be modified if the transaction commited successfully.
* UI: optimized login view for very small screen sizes
* Truncate in RocksDB will now do intermediate commits every 10.000 documents
if truncate fails or the server crashes during this operation all deletes
that have been commited so far are persisted.
* make the default value of `--rocksdb.block-cache-shard-bits` use the RocksDB
default value. This will mostly mean the default number block cache shard
bits is lower than before, allowing each shard to store more data and cause
less evictions from block cache
* issue #4222: Permission error preventing AQL query import / export on webui
* UI: optimized error messages for invalid query bind parameter
* UI: upgraded swagger ui to version 3.9.0
* issue #3504: added option `--force-same-database` for arangorestore
with this option set to true, it is possible to make any arangorestore attempt
fail if the specified target database does not match the database name
specified in the source dump's "dump.json" file. it can thus be used to
prevent restoring data into the "wrong" database
The option is set to `false` by default to ensure backwards-compatibility
* make the default value of `--rocksdb.block-cache-shard-bits` use the RocksDB
default value. This will mostly mean the default number block cache shard
bits is lower than before, allowing each shard to store more data and cause
less evictions from block cache
* fixed issue #4255: AQL SORT consuming too much memory
* fixed incorrect persistence of RAFT vote and term
v3.3.2 (2018-01-04)
-------------------
@ -3652,10 +3673,10 @@ v2.7.3 (2015-12-17)
`syncCollection` if the collection was dropped right before synchronization
and drop and (re-)create collection markers were located in the same WAL file
* fixed an issue where overwriting the system sessions collection would break
the web interface when authentication is enabled
v2.7.2 (2015-12-01)
-------------------

View File

@ -2965,7 +2965,7 @@ AstNode* Ast::optimizeAttributeAccess(AstNode* node, std::unordered_map<Variable
size_t const n = what->numMembers();
for (size_t i = 0; i < n; ++i) {
AstNode const* member = what->getMember(0);
AstNode const* member = what->getMember(i);
if (member->type == NODE_TYPE_OBJECT_ELEMENT &&
member->getStringLength() == length &&

View File

@ -53,6 +53,20 @@ function ahuacatlOptimizerTestSuite () {
tearDown : function () {
},
testAttributeAccessOptimization : function () {
let query = "LET what = { a: [ 'foo' ], b: [ 'bar' ] } FOR doc IN what.a RETURN doc";
let actual = getQueryResults(query);
assertEqual([ 'foo' ], actual);
query = "LET what = { a: [ 'foo' ], b: [ 'bar' ] } FOR doc IN what.b RETURN doc";
actual = getQueryResults(query);
assertEqual([ 'bar' ], actual);
query = "LET what = { a: [ 'foo' ], b: [ 'bar' ], c: [ 'baz' ] } FOR doc IN what.c RETURN doc";
actual = getQueryResults(query);
assertEqual([ 'baz' ], actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test special case "empty for loop"
////////////////////////////////////////////////////////////////////////////////