Skip to content
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

Simplify ignore_malformed handling for synthetic souce in aggregate_metric_double #109888

Merged

Conversation

lkts
Copy link
Contributor

@lkts lkts commented Jun 18, 2024

This PR reworks the logic to follow the pattern from #109882. This also fixes the edge case of array of values some of which are malformed.

@lkts lkts added >non-issue :StorageEngine/Mapping The storage related side of mappings labels Jun 18, 2024
* Typical use case is to gather field values from doc_values and append malformed values
* stored in a different field in case of ignore_malformed being enabled.
*/
public class CompositeSyntheticFieldLoader implements SourceLoader.SyntheticFieldLoader {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all from #109882.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@lkts
Copy link
Contributor Author

lkts commented Jun 19, 2024

@elasticmachine update branch

}

if (malformedDataForSyntheticSource != null) {
context.doc().add(IgnoreMalformedStoredValues.storedField(name(), malformedDataForSyntheticSource));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blocks gets repeated, consider moving it to a helper in IgnoreMalformedStoredValues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it if you don't mind i don't think it's too bad of a repetition.

name(),
new AggregateMetricSyntheticFieldLoader(name(), simpleName(), metrics),
new CompositeSyntheticFieldLoader.MalformedValuesLayer(name())
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cute :)

@@ -779,7 +779,7 @@ public void write(XContentBuilder b) throws IOException {
if (metricHasValue.isEmpty()) {
return;
}
b.startObject(simpleName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question, why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #109882.


- match:
_source:
metric: [{"min": 18.2,"max": 100.0, "value_count": 1}, "hey", 123, 456]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment about missing the [123, 456] pair.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #109882.

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lkts lkts merged commit e41a10e into elastic:main Jun 20, 2024
15 checks passed
@lkts lkts deleted the refactor_aggregate_metric_double_ignore_malformed branch June 20, 2024 18:07
@felixbarny felixbarny mentioned this pull request Aug 6, 2024
50 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants