-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
remove JsonTermWriter #2238
remove JsonTermWriter #2238
Conversation
143cd70
to
95343c1
Compare
95343c1
to
584d19f
Compare
json_term_writer, | ||
DateTime::from_utc(dt_utc), | ||
)); | ||
term.append_type_and_fast_value(DateTime::from_utc(dt_utc)); |
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 suspect this is a bug or a bug in waiting.
For this to work, we need term to not contain any value at this point.
2afa480
to
ce04b98
Compare
src/core/json_utils.rs
Outdated
phrase: &str, | ||
) -> Option<Term> { | ||
/// Tries to infer a JSON type from a string and append it to the term. | ||
pub(crate) fn convert_to_fast_value_and_append(term: &Term, phrase: &str) -> Option<Term> { |
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.
the prototype and/or the impl is a bit silly / misleading.
We pass a reference but always start by cloning it... even though we sometime return None in the end.
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 cloned it, because it's not performance critical and simplifies the code
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 PR contains several pitfalls. It cannot be merged as is.
9a1b756
to
8b21d88
Compare
/// Append a type marker + fast value to a term. | ||
/// This is used in JSON type to append a fast value after the path. | ||
/// | ||
/// It will not clear existing bytes. | ||
pub(crate) fn append_type_and_fast_value<T: FastValue>(&mut self, val: T) { | ||
self.0.push(T::to_type().to_code()); |
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.
can we have debug assert here too?
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.
In indexing we don't have a path, but a path id, so the debug_assert doesn't work here. It's also atypical for the Term methods, they are just building blocks, and the caller has to know the Term state
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.
the comment made me think it was only for json. So it is not?
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.
It is, but there are two JSON currently
Indexing: [FieldId][PathId][Value]
Query: [FieldId][JsonPath][JsonPathEnd][Value]
When we switch to [PathId][Value]
for all data during Indexing, we can split Term
into Term
and IndexingTerm
with a clearer API.
982bc22
to
b5d07c1
Compare
remove JsonTermWriter remove path truncation logic, add assertion
* remove JsonTermWriter remove JsonTermWriter remove path truncation logic, add assertion * fix json_path_writer add sep logic
No description provided.