-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Improve block loader for source only runtime fields of type double. #134629
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
Improve block loader for source only runtime fields of type double. #134629
Conversation
By using the FallbackSyntheticSourceBlockLoader instead of generic DoubleScriptBlockLoader. Relates to elastic#134121
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Hi @martijnvg, I've created a changelog YAML for you. |
public BlockLoader blockLoader(BlockLoaderContext blContext) { | ||
return new DoubleScriptBlockDocValuesReader.DoubleScriptBlockLoader(leafFactory(blContext.lookup())); | ||
var indexSettings = blContext.indexSettings(); | ||
if (isParsedFromSource && indexSettings.getIndexMappingSourceMode() == SourceFieldMapper.Mode.SYNTHETIC |
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: indentation
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 is how spotless formatted it :) I fixed the indentation, but since I copied from long script field type, I generalized the logic, it should be reusable for other runtime field types as well.
// In that case there is no ignored source entry, and so we need to fail back to LongScriptBlockLoader. | ||
// We could optimize this, but at this stage feels like a rare scenario. | ||
&& blContext.lookup().onlyMappedAsRuntimeField(name())) { | ||
var reader = new NumberType.NumberFallbackSyntheticSourceReader(NumberType.DOUBLE, null, true) { |
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 have a test for this code path?
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, this is tested in the testBlockLoaderSourceOnlyRuntimeFieldWithSyntheticSource()
test, which is also included in this change.
Note that this change should yield similar improvement as: #134117 (comment) |
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, thanks!
…double_runtime_field
…lastic#134629) By using the FallbackSyntheticSourceBlockLoader instead of generic DoubleScriptBlockLoader. Relates to elastic#134121
…lastic#134629) By using the FallbackSyntheticSourceBlockLoader instead of generic DoubleScriptBlockLoader. Relates to elastic#134121
BASE=abd8b324ee1890ff50e34db656d9ed1d3f3e62d4 HEAD=45a5e24aa565598fb91e2933213d81e462ab103e Branch=main
BASE=abd8b324ee1890ff50e34db656d9ed1d3f3e62d4 HEAD=45a5e24aa565598fb91e2933213d81e462ab103e Branch=main
BASE=abd8b324ee1890ff50e34db656d9ed1d3f3e62d4 HEAD=45a5e24aa565598fb91e2933213d81e462ab103e Branch=main
By using the FallbackSyntheticSourceBlockLoader instead of generic DoubleScriptBlockLoader.
Relates to #134121