dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[ENHANCEMENT]: BigInt data type support

Open rderbier opened this issue 1 year ago • 2 comments

Use case and current behavior

DQL types include int64. Some use cases (finance and others) require arbitrary-precision arithmetic (big numbers).

Enhancement

Big.Int must be supported.

As Go Big package also has Rat (rational) Float, would be nice to have those types too.

Solution proposal

No response

Links to Discuss, RFC or previous Issues and PRs

No response

Links to examples and research

No response

Additional Information

No response

rderbier avatar May 01 '23 20:05 rderbier

There was some demand in the past to add support for BigDecimal scalar types like uint256. We currently only support int64 for decimal scalar types and uint64 for the UID type. This was added as a low priority backlog via the GitHub issue and later 'Closed'.

But uint256 is heavily used in all crypto implementations. Ethereum uses 256-bit words natively. Their design rationale is that 4 or 8 byte words are too restrictive to store both addresses and values for computations and 32 byte words provide the perfect balance between performance and building a successful GAS model around it. Banks and financial institutions also rely on BigDecimal to avoid loss of precision while working with very large numbers.

Some requests from customers for this feat.:

https://discuss.dgraph.io/t/support-arbitrary-precision-numeric-types/8746 https://discuss.dgraph.io/t/data-type-for-money/4899/3 https://github.com/dgraph-io/dgraph/issues/2107

This feature was requested in the recent past by multiple prospects in the fields of finance, commerce and block-chain etc.

rarvikar avatar May 02 '23 10:05 rarvikar

Existing work on this feature: https://github.com/dgraph-io/dgraph/pull/3981

mangalaman93 avatar May 02 '23 18:05 mangalaman93

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

github-actions[bot] avatar Jul 18 '24 02:07 github-actions[bot]