blaze / datashape

Language defining a data description protocol
BSD 2-Clause "Simplified" License
183 stars 65 forks source link

Add Decimal type to DataShape #170

Closed dan-coates closed 8 years ago

dan-coates commented 9 years ago

This implements a Decimal object in DataShape, with precision and scale attributes, which downsample to ints and float64 when converted to NumPy.

I diverged a bit from the Decimal types envisioned in the DataShape type documentation, because different platforms in the SQL world (where I think Decimals will be most used) implement them differently. Therefore, the defining characteristic of a Decimal is not the number of bytes it takes (unlike for ints or floats), but rather the precision and scale that are defined for the type.

I also disallowed a Decimal without precision or scale specified, as different databases have radically different defaults for this case, so having a Decimal() dtype would only add confusion and chaos.

There's probably lots of further work to be done on the odo and Blaze sides to fully realize this, but this should get the ball rolling.