Skip to content

Graphops/uint256 #2

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Graphops/uint256 #2

wants to merge 11 commits into from

Conversation

chriswessels
Copy link
Member

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • I have checked the Release Timeline and Currently Supported Versions to determine which release branches I need to cherry-pick this PR into.

Documentation

  • My PR needs documentation updates.
Release note

Implements 256-bit unsigned integer type using ethnum::u256 library.

- Add UINT256 to protobuf data type enum
- Implement ScalarImpl, ScalarRef, and ScalarRefImpl for UInt256
- Add UInt256Array implementation with arrow compatibility
- Support serialization/deserialization in value encoding
- Add hash key support for uint256 values
- Include test utilities for generating random uint256 values
- Extend type macros to support uint256 throughout the codebase

This forms the foundation for uint256 support in RisingWave's type system.
- Map uint256 to Arrow Decimal256Array for data interchange
- Add iceberg compatibility mapping for uint256 type
- Support uint256 literals in frontend expression system
- Extend data type utilities to handle uint256
- Add JSON conversion support for uint256 values
- Update index selection rule to include uint256 type

Enables efficient data exchange with external systems through Arrow format.
- BigQuery: map uint256 to BIGNUMERIC type
- ClickHouse: use String representation for uint256
- Doris: encode as LARGEINT string representation
- DynamoDB: serialize as string attribute
- SQL Server: use VARCHAR(78) for uint256 values
- StarRocks: encode as LARGEINT string
- Add uint256 support in Avro, JSON, and Proto encoders
- Include uint256 in Debezium JSON formatter
- Extend MySQL and PostgreSQL parsers for uint256 compatibility

Ensures uint256 values can be properly exported to various sink systems.
- Add binary arithmetic operators: +, -, *, /, %
- Implement comparison operators: <, <=, >, >=, =, <>
- Extend expression type macros to support uint256
- Add uint256 literal parsing in expression binder
- Register uint256 in expression type system

Enables arithmetic operations and comparisons on uint256 values in SQL queries.
- Implement casts from numeric types to uint256
- Add casts from uint256 to int256 and decimal
- Support string to uint256 parsing
- Update cast matrix with Implicit, Assign, and Explicit contexts
- Handle overflow detection in numeric conversions

Allows seamless type conversions between uint256 and other numeric types.
- Add sum aggregation for uint256 values
- Implement min/max aggregates with proper state handling
- Support statistical aggregates: avg, stddev_pop, stddev_samp, var_pop, var_samp
- All statistical functions use float8 output type

Enables aggregation operations on uint256 columns in streaming and batch queries.
- PostgreSQL: convert numeric types to uint256 with validation
- JSON: parse uint256 from numeric and string representations
- Add error handling for invalid uint256 conversions
- Support list parsing for uint256 arrays

Enables ingestion of uint256 values from PostgreSQL and JSON sources.
- Assign OID 1305 for rw_uint256 base type
- Assign OID 1306 for _rw_uint256 array type
- Register types in pg_type system catalog
- Add proper I/O functions for PostgreSQL compatibility

Enables PostgreSQL clients to properly recognize and handle uint256 types.
- Test DDL operations: CREATE TABLE, ALTER TABLE with uint256
- Verify DML operations: INSERT, UPDATE, DELETE
- Test arithmetic operations and overflow behavior
- Validate aggregate functions: sum, min, max, avg
- Test type casting from numeric types and strings
- Verify connector integration with PostgreSQL and JSON sources
- Add boundary value tests for uint256 range

Ensures uint256 type works correctly across all SQL operations.
- Document complete uint256 type implementation plan
- Mark all three phases as complete with status indicators
- List known limitations (hex literals, u512 accumulator, bitwise ops)
- Include implementation details and file references
- Specify PostgreSQL OID assignments (1305/1306)

This specification serves as both design document and implementation guide
for the uint256 feature in RisingWave.
- Add SQL usage examples for DDL, DML, and queries
- Document connector integration patterns for PostgreSQL, JSON, and Avro
- Provide sink configuration examples for major systems
- Include common patterns like Wei to Ether conversion
- Document limitations and performance considerations
- Add best practices for handling overflow and external system integration

The user guide provides practical examples for blockchain and DeFi use cases
where uint256 is commonly needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant