Skip to content

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

Merged
alamb merged 4 commits into
apache:mainfrom
ding-young:interval
Sep 27, 2022
Merged

alamb merged 4 commits into
apache:mainfrom
ding-young:interval

Conversation

@ding-young

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

Copy link
Copy Markdown
Contributor

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

@alamb alamb left a comment •

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

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