-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Support malformed numbers in synthetic _source #90428
Support malformed numbers in synthetic _source #90428
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Hi @nik9000, I've created a changelog YAML for you. |
Pinging @elastic/es-search (Team:Search) |
This adds support for `ignore_malformed` to numeric fields other than `scaled_float` in synthetic `_source`. Their values are saved to a stored field and loaded to render the `_source`.
@@ -379,6 +383,7 @@ protected final class NumberSyntheticSourceSupport implements SyntheticSourceSup | |||
private final Function<Number, Number> round; | |||
private final Long nullValue = usually() ? null : randomNumber().longValue(); | |||
private final boolean coerce = rarely(); | |||
private final boolean ignoreMalformed = rarely(); |
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 specific test for this somewhere?
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's run rarely
like null value support or coerce or whatever. I could could run it on each run in a new test if you'd like. That way we're more likely to catch regressions faster....
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.
Yeah, I think I'd be happier with explicit tests for each configuration.
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've opened #90565 so we'll have known examples to test in addition to some tests each iteration.
…ed_numbers' into synthetic_source_ignore_malformed_numbers
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.
@romseygeek could you have another look at this one now that I've merged in my ignore_malformed
testing?
@@ -337,75 +337,76 @@ protected Object generateRandomInputValue(MappedFieldType ft) { | |||
} | |||
|
|||
@Override | |||
protected SyntheticSourceSupport syntheticSourceSupport() { |
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.
Pulled into a class so it's easier to read. sorry about the big diff.
private final InetAddress nullValue = usually() ? null : randomIp(randomBoolean()); | ||
private final boolean ignoreMalformed = rarely(); | ||
protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed) { | ||
return new IpSyntheticSourceSupport(ignoreMalformed); |
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've moved this to a named class so it'd be a bit easier to read.
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 for extending the test coverage.
return new SyntheticSourceExample(in, out, this::mapping); | ||
} | ||
protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed) { | ||
assumeFalse("scaled_float doesn't support ignore_above with synthetic _source", ignoreMalformed); |
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.
ignore_malformed
not ignore_above
, right?
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.
Yeah!
This adds support for
ignore_malformed
to numeric fields other thanscaled_float
in synthetic_source
. Their values are saved to a stored field and loaded to render the_source
.