Expand description
Functions related to Materialize’s numeric type, which is largely a wrapper
around rust-dec
.
Modules§
- str_
serde - Module to simplify serde’ing a
Numeric
through its string representation.
Structs§
- Invalid
Numeric MaxScale Error - The error returned when constructing a
NumericMaxScale
from an invalid value. - Numeric
MaxScale - The
max_scale
of aScalarType::Numeric
. - Packed
Numeric - An encoded packed variant of
Numeric
. - Proto
Numeric MaxScale - Proto
Optional Numeric MaxScale - Helper struct for representing
Option<NumericMaxScale>
.
Constants§
- NUMERIC_
AGG_ MAX_ PRECISION - The maximum number of digits expressable in a
NumericAgg
value. - NUMERIC_
AGG_ WIDTH - The number of internal decimal units in a
NumericAgg
value. - NUMERIC_
AGG_ WIDTH_ USIZE - The value of
NUMERIC_AGG_WIDTH
as au8
. - NUMERIC_
DATUM_ MAX_ PRECISION - The maximum number of digits expressable in a
Numeric
value. - NUMERIC_
DATUM_ WIDTH - The number of internal decimal units in a
Numeric
value. - NUMERIC_
DATUM_ WIDTH_ USIZE - The value of
NUMERIC_DATUM_WIDTH
as au8
.
Statics§
Traits§
- Dec
- Traits to generalize converting
Decimal
values to and from their coefficients’ two’s complements. - Decimal
Like - A type that can represent Real Numbers. Useful for interoperability between Numeric and floating point.
Functions§
- cx_agg
- Returns a new context appropriate for operating on numeric aggregates.
- cx_
datum - Returns a new context appropriate for operating on numeric datums.
- get_
precision - Returns
n
’s precision, i.e. the total number of digits represented byn
in standard notation not including a zero in the “one’s place” in (-1,1). - get_
scale - Returns
n
’s scale, i.e. the number of digits used after the decimal point. - munge_
numeric - Ensures
Numeric
values are: - negate_
twos_ 🔒complement_ le - Using negative binary numbers can require more digits of precision than
Numeric
offers, so we need to have the option to swap bytes’ signs at the byte- rather than the library-level. - numeric_
to_ twos_ complement_ be - Converts an
Numeric
into its big endian two’s complement representation. - numeric_
to_ 🔒twos_ complement_ inner - numeric_
to_ twos_ complement_ wide - Converts an
Numeric
into a big endian two’s complement representation where the encoded value hasNUMERIC_AGG_MAX_PRECISION
digits and a scale ofNUMERIC_DATUM_MAX_PRECISION
. - rescale
- Rescale
n
as anOrderedDecimal
with the described scale, or error if: - rescale_
within_ 🔒max_ precision - Rescale’s
n
to fit withinNumeric
’s max precision or error if not possible. - twos_
complement_ be_ to_ numeric - twos_
complement_ be_ to_ numeric_ inner - Parses a buffer of two’s complement digits in big-endian order and converts
them to
Decimal<N>
. - twos_
complement_ 🔒be_ to_ u128
Type Aliases§
- Numeric
- A numeric value.
- Numeric
Agg - A double-width version of
Numeric
for use in aggregations.