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

Adds support for parameterized decimal cast #1483

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Adds support for parameterized decimal cast #1483

merged 1 commit into from
Jun 6, 2024

Conversation

RCHowell
Copy link
Member

@RCHowell RCHowell commented Jun 5, 2024

Relevant Issues

#974

Description

Today the planner only has a cast_decimal(v) function which is used in coercions but does not support parameters. This PR adds cast_decimal(v, p, s) along with using the parameters in typing judgements.

CAST(v AS DECIMAL)      -- arbitrary precision/scale decimal
CAST(v AS DECIMAL(P))   -- decimal with precision = P and scale = 0
CAST(v AS DECIMAL(P,S)) -- decimal with precision = P and scale = S
-- | AST                        | Plan
--------------------------------|----------------------
CAST(v AS DECIMAL)           -- | cast_decimal(v)
CAST(v AS DECIMAL(P))        -- | cast_decimal(v, P, 0)
CAST(v AS DECIMAL(P,S))      -- | cast_decimal(v, P, S)

Other Information

  • Updated Unreleased Section in CHANGELOG: [YES/NO]
    No

  • Any backward-incompatible changes? [YES/NO]
    No

  • Any new external dependencies? [YES/NO]
    No

  • Do your changes comply with the Contributing Guidelines
    and Code Style Guidelines? [YES/NO]
    Yes

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@johnedquinn johnedquinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Approving knowing that we will be adding full-fledged support for parameterized types in the future.

@RCHowell RCHowell merged commit a02ecde into main Jun 6, 2024
10 checks passed
@RCHowell RCHowell deleted the decimal-casts branch July 18, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants