Skip to content

Add Fixed-Point Numeric data type #13625

@polyfractal

Description

@polyfractal

Fixed-point numerics allow the user to specific the number of significant digits they are interested in. E.g. a user may only care about two sig-figs (5.01, 123.19, etc). instead of the full 6-9 sig-figs in 32bit floats.

Fixed-point numerics can be "layered" on top of our existing support for Longs without too much hassle. Additional information would need to be saved, such as the number of bits for the fractional component, and the base/sign if it is configurable. Input/output formatting would also need to know how to convert into the appropriate representation.

But most of the "guts" should work seamlessly. Ranges are unaffected, aggregations convert everything to Double anyway, etc

Fixed-point has two notable advantages:

  • Most important to me, since fixed-points are basically Longs in disguise, they can leverage the compression tricks used in doc values to drastically decrease their on-disk footprint. In contrast, floats/doubles are stored at their full size since there is no way to encode fp in a random-access format without introducing error

    Many "pure metrics" will only care about a few sig-figs (do you really care if your CPU usage is 53.0000001% vs 53.00%) but the space savings will definitely be appreciated

  • As a more expert-level feature, if the user knows their dynamic range, they can obtain better precision for their use-case. E.g. if your range is 0-1 exclusive, a fixed-point can be more precise than floating because you can dedicate all 32 bits to the fractional component instead of only 24bits in the float

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions