-
Notifications
You must be signed in to change notification settings - Fork 135
Stats queries return integers as numbers, floats as strings #278
Comments
I just discovered the same thing. For quick reference, here's a sample query: |
@siruguri would you have time to take a look at what's going on here? |
I have to re-install elastic search because I got a new laptop, and remind On Wed, Feb 17, 2016 at 2:19 PM, Sarah Allen notifications@github.com
|
in controllers.rb, line 75, the So the solution would be either to intercept the I am not too sure when I can get to this, maybe next week? I know I also On Wed, Feb 17, 2016 at 2:27 PM, Sameer Siruguri siruguri@gmail.com wrote:
|
So the writer of Should I do that? Should we instead let the numbers be strings so that the client system can decide how to re-cast to their version of the floating-point type? |
Sorry to be so slow, @siruguri! Ugh, this is a nasty one, and I'm really torn. Providing floats as strings feels like giving a worse user/developer experience in return for a level of accuracy that - in all the existing use cases, anyway - really isn't needed. On the other hand, Open-data-maker is meant to be domain-agnostic, and I can't speak for the needs of future data sets and their users. (On the other other hand, I don't know what ES uses for its floats internally; the accuracy may already have been compromised before the stats were emitted.) My inclination is to monkey-patch in favour of a better user experience. What does everyone else think? |
I'm open to either solution though I think I'd rather un-string the value On Fri, Mar 4, 2016 at 12:18 PM, Yoz Grahame notifications@github.com
|
In fact, now that I think about it,
sounds equiv to, "let's cast the |
@siruguri Yes, that sounds like the right option to me. Thank you! |
* We prefer having floats in our JSON strings, rather than strings when the source data type is BigDecimal.
Example:
... whereas what we get when querying ES directly is:
I initially thought this was something to do with Ruby mis-parsing scientific notation, but now I suspect it's something in our type-detection output code.
The text was updated successfully, but these errors were encountered: