-
Notifications
You must be signed in to change notification settings - Fork 181
Fixes #7872
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
Fixes #7872
Conversation
src/realm/array_string.cpp
Outdated
if (m_type == Type::interned_strings) { | ||
return StringID(static_cast<Array*>(m_arr)->get(ndx)); | ||
} | ||
auto str = get(ndx); |
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.
nit: const auto
src/realm/query_engine.cpp
Outdated
{ | ||
if (m_needles.empty()) { | ||
return m_leaf->find_first(m_string_value, start, end); | ||
return m_leaf->find_first(m_string_value, start, end, m_interned_string); |
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.
Ok I see, you are reusing the ID if we got already one, as it was before. NIT, maybe can we call m_interned_string_id
to differentiate from m_string_interner
public: | ||
constexpr static bool case_sensitive_comparison = | ||
is_any_v<TConditionFunction, Greater, GreaterEqual, Less, LessEqual>; | ||
is_any_v<TConditionFunction, NotEqual, Greater, GreaterEqual, Less, LessEqual>; |
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.
Why adding NotEqual
to case-insensitive comparison?
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.
Because it was missing. Aparently we did not have any tests for that. (And it is case sentitive, not insensitive)
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 will try to make a failing test
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.
OK - it works anyway. But in many cases we construct the m_ucase and m_lcase when they are not needed.
src/realm/query_engine.hpp
Outdated
const auto id = m_leaf->get_string_id(s); | ||
if (m_string_interner->compare(*m_interned_string, *id) != 0) | ||
return s; | ||
continue; |
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.
This continue is a bit tricky here. Essentially we want to skip getting the string by index s
at line 1702, since we know that we won't find any match. Maybe a small comment just to be sure we are not going to delete this continue in the future.
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 have re-arranged the code a bit.
* find_first optimization for compressed strings * core test passing * compression tests for collection of strings * code review * Fixes (#7872) --------- Co-authored-by: Jørgen Edelbo <jorgen.edelbo@mongodb.com>
What, How & Why?
☑️ ToDos
bindgen/spec.yml
, if public C++ API changed