-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Fixed geo point block loader slowness #136147
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
base: main
Are you sure you want to change the base?
Conversation
Hi @Kubik42, I've created a changelog YAML for you. |
e7afa0b
to
1f168f2
Compare
|
||
@Override | ||
public BlockLoader blockLoader(BlockLoaderContext blContext) { | ||
if (blContext.fieldExtractPreference() == DOC_VALUES && hasDocValues()) { |
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.
Wouldn't a smaller change be to just change:
if ((blContext.fieldExtractPreference() == DOC_VALUES || isSyntheticSource)&& hasDocValues()) {
?
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, but shouldn't we be taking the FieldExtractPreference = NONE
into account as well? Also, we're falling back to loading values from _source when store = true
, that seems like a bug as well.
The reason for failing tests is here. Whenever there is no Perhaps the bigger problem here is that |
In my rabbit hole of understanding how BlockLoaders work, I found a somewhat of a bug thats in main. When a For example, the following command fails:
with:
Based on what I've read in the code, this precision loss is expected. That being said, its not documented publicly. |
There is also a problem with using When block loading, I get the error: My guess is that it has something to do with the geo_point being stored as a String, rather than being converted to WKT first. That said, even when I used For now, I've just followed what we do in GeoShapeWithDocValuesFieldMapper and changed the block loader to This needs further discussion. |
1f168f2
to
b586f4c
Compare
} | ||
if (store) { | ||
context.doc().add(new StoredField(fieldType().name(), geometry.toString())); | ||
context.doc() |
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 don't think we should be changing how geo points are stored as stored fields.
If compute engine is expecting a different type with NONE field extract preference, maybe we should just give that without falling back to source based block loader? By implementing a different block loader for this case that mimics what its synthetic source support does?
I think want to implement a block loader that return WKB binary format that is converted from numeric doc values. This is kind of what happens now with source based block loader for geoip field type (but then by synthesizing all fields).
I did a little more investigating and found that the reason we end up with This got me thinking, why are we setting the preference to
However, doing so causes some type inequality exceptions. Nhat pointed out this code, which suggests that doc_values shouldn't be always be used. However, that conflicts with the definition of |
This addresses #135891
TODO: write up explanation of what went wrong and his this PR fixes it