Skip to content
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 Decimal256 in YQL #9397

Open
alexv-smirnov opened this issue Sep 17, 2024 · 1 comment
Open

Support Decimal256 in YQL #9397

alexv-smirnov opened this issue Sep 17, 2024 · 1 comment
Labels
area/yql YQL query language issues

Comments

@alexv-smirnov
Copy link
Member

So far, only decimals up to 35 digits are supported, as Decimal128 allows up to 38 digits and 12 bits are reserved for an inline representation.

For some cases, this is not sufficient and usually systems support up to 76 digits which is a maximum for Decimal256 (see Clickhouse docs for instance https://clickhouse.com/docs/en/sql-reference/data-types/decimal).

YQL support is required to implement the support of the type on the YTsaurus side. Later, this type can be supported on the YDB side. Actually, there was earlier reported an issue to implement this in YDB: #151

@alexv-smirnov alexv-smirnov added the area/yql YQL query language issues label Sep 17, 2024
@Tony-Romanov
Copy link
Collaborator

Tony-Romanov commented Oct 10, 2024

Requirements:

  • Extend the existing Decimal type to be able to specify a large Precision up to 76.
  • For Precision values ​​in the range of 1 - 35, nothing changes and the value is stored as an Int120 inside TUnboxedValuePod.
  • For Precision values ​​in the range of 36 - 76, the value is stored as a binary string of 32 bytes (similar to a UUID) and is an Int256 (a pair of Int128, Uint128).
  • Serialization of large Decimals must be binary compatible with that of small Decimals including the special values ​​Nan, Inf.
  • All built-in functions that work with small Decimals, such as conversions, comparisons, arithmetic, etc., must work with large Decimals as well.
  • All aggregations that work with small Decimals, such as sum, min, max, etc., must work with large Decimals as well too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/yql YQL query language issues
Projects
None yet
Development

No branches or pull requests

2 participants