Use BigInt lib for returning large numbers
See original GitHub issueI understand that the LONG datatype can’t be larger than 64bit. It’d be great if you could return a number larger than 64 bit when aggregating numeric datatypes.
Problem description:
When calculating the SUM of a LONG field, I get an exception: NotSerializableExceptionWrapper: arithmetic_exception: long overflow
Steps to reproduce:
CREATE TABLE testa(aa LONG)
Run this query multiple times:
INSERT INTO testa(aa) VALUES (8888888888888888888)
SELECT SUM(aa) FROM testa
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
BigInt - JavaScript - MDN Web Docs
BigInt values represent numeric values which are too large to be represented by the ... Returns true if the passed BigInt value is...
Read more >Handling large numbers in C++? - biginteger - Stack Overflow
It doesn't use any 3rd-party library. I have used this to handle huge numbers (as long as you have enough memory to store...
Read more >A guide to using BigInt - LogRocket Blog
BigInt gives us the ability to work with large numbers without having to worry about potentially losing precision (digits) or weird ...
Read more >Using JavaScript BigInt to Represent Large Numbers
To represent integers larger than 2 to the 53rd power minus 1 in JavaScript, we can use the BigInt object to represent the...
Read more >BigInt (BIG INTEGERS) in C++ with Example - GeeksforGeeks
The following operations are being performed on BigInt-. Defining some big integers. Checking the number of digits in the big integer.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have tried to reproduce the same. Created a table with a attribute values of type lONG & added 150 records of values 9999999999999999. Tried to do an aggregation “SUM” on this particular table and got “ArthimeticException error”. Added the screenshot.
Also, I have started working on fixing it by refactoring the code to use BIGINT. I will create a PR soon and will share the link here and we can discuss further.
Look forward
We’ve implemented this by https://github.com/crate/crate/pull/10854, which will be part of the next CrateDB 4.4 feature release.