Skip to content

Port PrimitiveValueTest test for core::Query #1530

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 5 commits into from
Jul 17, 2018
Merged

Conversation

rsgowman
Copy link
Member

(From java.)

Also fix a bug uncovered by the test. (oops)

(From java.)

Also fix a bug uncovered by the test. (oops)
@@ -54,15 +54,15 @@ bool RelationFilter::MatchesValue(const FieldValue& other) const {
bool RelationFilter::MatchesComparison(const FieldValue& other) const {
switch (op_) {
case Operator::LessThan:
return value_ < other;
return other < value_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: this looks a little counterintuitive now that the order has been changed, due to the names. Unfortunately, I don't really have a good suggestion, but even renaming value_ to rhs_, though perhaps not elegant, would at least explain the ordering. (another rough idea is compare_what < compare_to_).

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree about the counterintuitive part (which is perhaps obvious, given that I originally reversed these!)

I've renamed value_ to value_rhs_

@var-const var-const assigned rsgowman and unassigned var-const Jul 13, 2018
Copy link
Contributor

@zxu123 zxu123 left a comment

Choose a reason for hiding this comment

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

LGTM

@wilhuff
Copy link
Contributor

wilhuff commented Jul 16, 2018

The travis failure was fixed in #1544. Merge the latest master to fix it.

@@ -47,22 +49,22 @@ bool RelationFilter::Matches(const model::Document& doc) const {

bool RelationFilter::MatchesValue(const FieldValue& other) const {
// Only compare types with matching backend order (such as double and int).
return FieldValue::Comparable(value_.type(), other.type()) &&
return FieldValue::Comparable(value_rhs_.type(), other.type()) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This now looks wrong (it's value_rhs_ but it's on the left).

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

@rsgowman rsgowman merged commit 8903212 into master Jul 17, 2018
@rsgowman rsgowman deleted the rsgowman/query2 branch July 17, 2018 14:28
@firebase firebase locked and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants