Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Added validation that vector is not NaN #100

Merged

Conversation

jmazanec15
Copy link
Member

Issue #, if available:
#99

Description of changes:
Added validation in VectorFieldMapper to check for vector values of NaN and throwing an Exception if so.

Added test case.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jmazanec15 jmazanec15 requested a review from vamshin April 27, 2020 19:36
@@ -250,10 +250,16 @@ public void parse(ParseContext context) throws IOException {
if (token == XContentParser.Token.START_ARRAY) {
token = context.parser().nextToken();
while (token != XContentParser.Token.END_ARRAY) {
if (Float.isNaN(context.parser().floatValue())) {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I think that makes sense.

Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix

@jmazanec15 jmazanec15 merged commit b1bd276 into opendistro-for-elasticsearch:master Apr 28, 2020
@jmazanec15 jmazanec15 deleted the nan-bug-fix branch April 28, 2020 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants