8000 Bug fix/internal issue #316 by gnusi · Pull Request #7911 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/internal issue #316 #7911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jan 10, 2019
Merged

Bug fix/internal issue #316 #7911

merged 26 commits into from
Jan 10, 2019

Conversation

gnusi
Copy link
Contributor
@gnusi gnusi commented Jan 8, 2019

Please note that for legal reasons we require you to sign the
Contributor Agreement
before we can accept your pull requests.

gnusi added 12 commits December 21, 2018 20:13
Signed-off-by: Andrey Abramov <andrey@arangodb.com>
…-fix/internal-issue-#316

# Conflicts:
#	arangod/IResearch/AqlHelper.cpp
#	arangod/IResearch/AqlHelper.h
#	arangod/IResearch/IResearchOrderFactory.cpp
#	arangod/IResearch/IResearchOrderFactory.h
#	arangod/IResearch/IResearchViewNode.cpp
#	arangod/IResearch/IResearchViewNode.h
#	arangod/IResearch/IResearchViewOptimizerRules.cpp
@gnusi gnusi requested a review from jsteemann January 8, 2019 17:37
@ghost ghost assigned gnusi Jan 8, 2019
@ghost ghost added the 2 - Working label Jan 8, 2019
@gnusi
Copy link
Contributor Author
gnusi commented Jan 8, 2019

@gnusi
Copy link
Contributor Author
gnusi commented Jan 9, 2019

@gnusi
Copy link
Contributor Author
gnusi commented Jan 10, 2019

return false;
}

size_t const n = lhs->numMembers();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to compare a node's flags attribute here?

In most cases the flags should not make a difference IMHO, just wondering if there are any cases where the flags would matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get, which flags attribute do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An AstNode has a flags member, which contains some computed information.
To my knowledge, that information can always be recomputed, so it should not matter when comparing two AstNodes.

case aql::NODE_TYPE_OPERATOR_BINARY_TIMES:
case aql::NODE_TYPE_OPERATOR_BINARY_DIV:
case aql::NODE_TYPE_OPERATOR_BINARY_MOD:
case aql::NODE_TYPE_OPERATOR_BINARY_EQ:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the array variants of the operators, e.g. NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ intentionally not supported here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give me an example of how NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ can be expressed in AQL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NODE_TYPE_OPERATOR_BINARY_EQ: a == b
NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ: [1,2,3] ALL IN b

}

case aql::NODE_TYPE_VALUE:
case aql::NODE_TYPE_OBJECT: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this only need to handle object literals with already-known values, or does this also need to handle objects with dynamic values inside, e.g.

{ "a" : 1, "b": 2 } // object literal, should work when using aql::CompareAstNodes
{ "a" : foo.bar } // object with runtime values, will probably not work right now
{ [name] : 2 } // object with dynamic attribute name, will probably not work right now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I have to cover object case manually

case aql::NODE_TYPE_OPERATOR_BINARY_TIMES:
case aql::NODE_TYPE_OPERATOR_BINARY_DIV:
case aql::NODE_TYPE_OPERATOR_BINARY_MOD:
case aql::NODE_TYPE_OPERATOR_BINARY_EQ:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the array variants of the operators, e.g. NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ intentionally not supported here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give me an example of how NODE_TYPE_OPERATOR_BINARY_ARRAY_EQ can be expressed in AQL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

auto sub = node->getMemberUnchecked(i);

if (sub) {
hash = fasthash64(static_cast<const void*>(sub->getStringValue()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes each object attribute member is of type NODE_TYPE_OBJECT_ELEMENT.
At least in theory object attribute members can also have the type NODE_TYPE_CALCULATED_OBJECT_ELEMENT, but I am not sure if that is allowed here.
Example:

{ [ CONCAT("test" + 1) ] : "foo" }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check it, thanks

var scorers = '';
if (node.scorers && node.scorers.length > 0) {
scorers = keyword(' LET ');
for (var j = 0;;) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be simplified to

scorers = keyword(' LET ' ) + node.scorers.map(function(scorer) {
  return variableName(scorer) + ' = ' + buildExpression(scorer.node);
}).join(', ');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jsteemann
Copy link
Contributor

Apart from the above, I am wondering if the change of the scorer serialization data is a compatibility problem, e.g. while performing a rolling upgrade, when some servers in a cluster may use version 3.4 and some already use 3.5/devel.
Coordinators are supposed to be upgraded after all DB servers have been upgraded, so I think at least 3.5 DB servers receiving "old" query plan snippets from 3.4 coordinators need to still handle the old format.

@gnusi
Copy link
Contributor Author
gnusi commented Jan 10, 2019

This PR doesn't touch score serialization at all, the only thing it does is allow users to use scorer function outside of SORT statement, e.g. in arbitrary calculations. That means, while performing a rolling upgrade, those coordinators which are outdated will simply decline unsupported queries even if all db server were already updated. A long story short - these changes are backwards compatible

@gnusi gnusi merged commit d4a010b into devel Jan 10, 2019
@ghost ghost removed the 2 - Working label Jan 10, 2019
ObiWahn added a commit that referenced this pull request Jan 11, 2019
* origin/devel:
  Doc - Extend generation of program option tables (#7888)
  Bug fix/internal issue #316 (#7911)
  fix openssl 1.3 usage
ObiWahn added a commit that referenced this pull request Jan 11, 2019
…y-line

* origin/devel:
  Doc - Extend generation of program option tables (#7888)
  Bug fix/internal issue #316 (#7911)
  fix openssl 1.3 usage
  upgrade to boost 1.69.0 (#7910)
  Doc - Add a paragraph that JS JS trxs are excluded from intermediate commits. (#7919)
ObiWahn added a commit that referenced this pull request Jan 11, 2019
… feature/aql-blocks-by-line-executor-calculation

* origin/feature/aql-blocks-by-line:
  Doc - Extend generation of program option tables (#7888)
  Bug fix/internal issue #316 (#7911)
  fix openssl 1.3 usage
  upgrade to boost 1.69.0 (#7910)
  Doc - Add a paragraph that JS JS trxs are excluded from intermediate commits. (#7919)
@fceller fceller deleted the bug-fix/internal-issue-#316 branch January 19, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0