-
Notifications
You must be signed in to change notification settings - Fork 171
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
Use search index also when following links #3432
Conversation
Change-Id: Ia8888fcf8530fd9b14740cab7228d320a0832887
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Virtually Epic!
template <> | ||
inline Mixed get_mixed(const Value<RowIndex>&) | ||
{ | ||
return Mixed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(false) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@@ -3883,6 +3986,22 @@ class Compare : public Expression { | |||
{ | |||
m_left->set_base_table(table); | |||
m_right->set_base_table(table); | |||
if (std::is_same<TCond, Equal>::value && m_left_is_const && m_right->has_search_index()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know that this will be triggered if the query is re-evaluated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the init function is called as part of both Query::find and Query::find:all
@@ -12218,5 +12218,66 @@ TEST(Query_StringOrLongStrings) | |||
} | |||
} | |||
|
|||
TEST(Query_LinksWithIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need unittests demonstrating correct operation across table changes and sync_if_needed() on dependent tableview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case modified.
Change-Id: If013cf622825a192ab00025f6b7832459b2d3550
289d77b
to
6d7443b
Compare
Change-Id: Ief3c1b7b40e4c2d9188c3d1993404f503eba232e
b181daa
to
14028b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me!
It would have been nice to see a benchmark showing the improvement, but that's not blocking.
@@ -101,6 +101,11 @@ class BinaryColumn : public ColumnBaseSimple { | |||
void verify() const override; | |||
void to_dot(std::ostream&, StringData title) const override; | |||
void do_dump_node_structure(std::ostream&, int) const override; | |||
void find_all(IntegerColumn&, BinaryData, size_t, size_t) const | |||
{ | |||
// Dummy implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert false here too?
src/realm/column_timestamp.hpp
Outdated
@@ -113,6 +113,11 @@ class TimestampColumn : public ColumnBaseSimple { | |||
return npos; | |||
} | |||
|
|||
void find_all(IntegerColumn&, Timestamp, size_t, size_t) const | |||
{ | |||
// Dummy implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timestamp column supports an index, doesn't this need to be implemented?
Change-Id: I564c45bcee7f64a296138e273171c015b802b073
Change-Id: I3354eebcd03e4578da92ce9a137bb13e2ea48579
5ba012c
to
5b81529
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 💯
The optimization added in #3432 to use the search index when performing equality queries over a link assumed that Queries would be evaluated in ascending table order, which is not always the case when the query is being performed on a link list. Fixes realm/realm-swift#6540.
The optimization added in #3432 to use the search index when performing equality queries over a link assumed that Queries would be evaluated in ascending table order, which is not always the case when the query is being performed on a link list. Fixes realm/realm-swift#6540.
…er (#3752) The optimization added in #3432 to use the search index when performing equality queries over a link assumed that Queries would be evaluated in ascending table order, which is not always the case when the query is being performed on a link list. Fixes realm/realm-swift#6540. * Remove an unused member variable Co-authored-by: Jørgen Edelbo <[email protected]>
Change-Id: Ia8888fcf8530fd9b14740cab7228d320a0832887