- Notifications
You must be signed in to change notification settings - Fork 25.6k
Use FallbackSyntheticSourceBlockLoader for number fields #122280
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 FallbackSyntheticSourceBlockLoader for number fields #122280
Conversation
} | ||
| ||
MappedFieldType ft = new NumberFieldType(context.buildFullName(leafName()), this); | ||
MappedFieldType ft = new NumberFieldType(context.buildFullName(leafName()), this, context.isSourceSynthetic()); |
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 to do this because this PR will be backported and in 8.x _source.mode
parameter is still operational.
Hi @lkts, I've created a changelog YAML for you. |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
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.
LGTM 👍
Great to see how this new block loader improves performance compared to the source based block loader.
@@ -0,0 +1,3 @@ | |||
package org.elasticsearch.benchmark.index.mapper; | |||
| |||
public class FallbackSyntheticSourceBlockLoaderBenchmark {} |
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.
Is the intend to include the benchmark?
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 didn't intend to do that, i am not sure how this ended up being here :)
var converted = type.parse(value, coerce); | ||
accumulator.add(converted); | ||
} catch (Exception e) { | ||
// Malformed value, skip it |
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 this is ok and it matches with the behavior of ignore malformed in es|ql? If a value is malformed it isn't available in doc values and never gets returned by the block loader.
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, we do the same for stored source.
// Transform number to correct type (e.g. reduce precision) | ||
accumulator.add(type.parse(rawValue, coerce)); | ||
} catch (Exception e) { | ||
// Malformed value, skip it./gradlew ":server:test" --tests |
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.
Remove ./gradlew ":server:test" --tests
?
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.
oops
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.
Looks great. Thanks @lkts
| ||
package org.elasticsearch.index.mapper.blockloader; | ||
| ||
import org.elasticsearch.logsdb.datageneration.FieldType; |
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 should graduate the datageneration
package out of logsdb at some point.
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 even have a PR for that but i've been changing things there and it was conflicting. I'll merge that in.
💚 Backport successful
|
This PR introduces an implementation of
FallbackSyntheticSourceBlockLoader
for number fields and related tests. This allows to not synthesize entire synthetic_source
in a block loader when doc_values are not available.unsigned_long
andscaled_float
are not covered in this PR.Benchmark results are below (lower is better). Note that we benchmark only
long
but these results should be representable since the implementation is very similar.before
after
Benchmark code
Contributes to #115394.