-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for uint256/int256 #15443
Comments
willing to add a bounty of $500 to the implementer of this feature. could be more when the scope of work is more clear. i guess we'll need support in arrow first. found this library that implements arbitrary sized uint: https://github.com/recmo/uint |
I think we want to support a Decimal backed by an Int256 in the future- this is also available in Arrow. Not sure about a true 256-bit integer. We should probably first debate adding |
two many things will be effect if adding new tyoes. ref duckdb/duckdb#8635 (comment) |
unfortunately decimal256 in arrow doesn't support the full range of uint256 values, it cuts off at 76 digits, which is approximately 252.4653 bits. import pyarrow as pa
pa.array([2**256-1], type=pa.decimal256(76, 0))
# ArrowInvalid: Decimal type with precision 78 does not fit into precision inferred from first array element: 76
pa.array([2**256-1], type=pa.decimal256(78, 0))
# ValueError: precision should be between 1 and 76 |
Willing to add $500 to the bounty @banteg proposed. |
@paradigmxyz (maintainers of Cryo) to chip in an additional $1K, incl. the Arrow integration in scope. |
What sort of operations would one expect to be able to do on this For the record, this issue is not yet accepted, we still need to discuss if we want this in Polars. Adding types is a lot of work, slows down future feature development, and increases the binary size of Polars by quite a bit. So implementers beware: even though third parties are offering PR bounties, that does not mean we will merge said PR's and you might not get paid if we end up deciding this is not in scope for Polars, or the drawbacks outweigh the positives. |
hi in terms of raw operations I think the most important functionality would be
these operations would be most commonly used in these contexts
concrete example: lets say you have a large dataframe of transactions (>100M rows). each row has a u256 column of tx price and a string/binary column of account id. you want to aggregate the total spend per account. right now the most common approach is to convert to f64 for tx price so that |
Totally @orlp definitely no expectation from our side and appreciate the clear communication. Makes sense and understand the nuances w.r.t maintenance, as we also follow a similar philosophy. Thank you for the swift reply. |
happy to chip in another $100 to this bounty |
This is a blocker for a lot of people and orgs, would be great to see it priorised. What can we do see it done faster? |
Description
The most commonly used data types for smart contracts and token math on the blockchain are uint256 and int256. Currently, people are resorting to inefficient methods like converting to float or string because there is no native support for these data types. For example, paradigmxyz/cryo exports duplicate data columns in various formats (float, binary, string) due to the absence of native support.
The text was updated successfully, but these errors were encountered: