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

Improve number handling by returning NaN for non-numbers #68

Merged
merged 2 commits into from
Sep 25, 2021

Conversation

DocLambda
Copy link
Contributor

When processing unknown documents, fields that should contain numbers might, for whatever reason, actually contain e.g. a string. In this case the current implementation is also a bit inconsistent and will return a float64(0) when performing a number(//some_string_field) query and will panic if executed on a string. The latter might happen if the query is constructed prgramatically.

The present PR changes the behavior such that the above query will return math.NaN() and leaves the value handling to the caller. If required, the previous behavior can be reconstructed in ceil, floor etc which will now also return NaNs.

@zhengchun zhengchun merged commit 696d123 into antchfx:master Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants