Skip to content

Decimal precision and scale enum #653

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

Closed
wants to merge 1 commit into from
Closed

Decimal precision and scale enum #653

wants to merge 1 commit into from

Conversation

AugustoFKL
Copy link
Contributor

Implementation of an enum to handle Decimal (1) precision and scale, instead of options, for two reasons:

  • An enum is easier to access and handle. Options need unwrap or errors even when you KNOW that an item should exist (e.g., DATETIME (p,s), if s is some, necessarily p is some).
  • Remove unwrap from our code. Even if they shouldn't happen, it's not nice to have unwraps as "certainty" handlers (that was happening when we printed stuff).

Since we already didn't accept DECIMAL data type only with scale, that doesn't change the behavior of anything.

[1] : https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type

@AugustoFKL
Copy link
Contributor Author

@alamb I based this one on #648, so it duplicates its changes. Is there a better way to approach situations like that?

I use its structure, so I'm kinda stuck on that. Trying to work on things that don't conflict isn't easy hehe

@coveralls
Copy link

coveralls commented Oct 4, 2022

Pull Request Test Coverage Report for Build 3182221106

  • 27 of 28 (96.43%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 85.661%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/data_type.rs 9 10 90.0%
Totals Coverage Status
Change from base Build 3181450573: 0.03%
Covered Lines: 10287
Relevant Lines: 12009

💛 - Coveralls

…as we don't need to handle the 4 possible ones
@AugustoFKL AugustoFKL closed this Oct 4, 2022
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.

3 participants