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

Move Value::Interval to Expr::Interval #609

Merged
merged 4 commits into from Sep 27, 2022
Merged

Conversation

ding-young
Copy link
Contributor

@ding-young ding-young commented Sep 10, 2022

Current ast Interval is defined as a variant of enum Value, which means a literal value. However, considering that the field value of Interval holds wrapped Expr, Value becomes somewhat requires endless evaluation... not "literal". Personally, it would be nice to change Value::Interval to Expr::Interval.

Interval {
        value: Box<Expr>,
        leading_field: Option<DateTimeField>,
        leading_precision: Option<u64>,
        last_field: Option<DateTimeField>,
        /// The seconds precision can be specified in SQL source as
        /// `INTERVAL '__' SECOND(_, x)` (in which case the `leading_field`
        /// will be `Second` and the `last_field` will be `None`),
        /// or as `__ TO SECOND(x)`.
        fractional_seconds_precision: Option<u64>,
    }

@alamb alamb changed the title Move Value::Interval to Expr::Interval Move Value::Interval to Expr::Interval Sep 27, 2022
Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This makes sense to me @ding-young -- thank you for the contribution

I think @togami2864 added Expr support for Interval in #517 whereas it previously was only a literal

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3099121905

  • 33 of 41 (80.49%) changed or added relevant lines in 3 files are covered.
  • 100 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.05%) to 85.609%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 3 4 75.0%
src/ast/mod.rs 21 28 75.0%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_common.rs 10 97.0%
src/parser.rs 90 83.27%
Totals Coverage Status
Change from base Build 3019512499: 0.05%
Covered Lines: 9768
Relevant Lines: 11410

💛 - Coveralls

@alamb alamb merged commit 3ac1bb5 into sqlparser-rs:main Sep 27, 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.

None yet

3 participants