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

hive: support for special not expression !a and raise error for a! factorial operator #1472

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wugeer
Copy link

@wugeer wugeer commented Oct 12, 2024

Closes: #1471
Closes: #1473

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11303950713

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 28 of 38 (73.68%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 89.298%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dialect/mod.rs 1 2 50.0%
src/dialect/postgresql.rs 1 2 50.0%
tests/sqlparser_hive.rs 13 15 86.67%
src/parser/mod.rs 12 18 66.67%
Totals Coverage Status
Change from base Build 11294882452: -0.02%
Covered Lines: 30172
Relevant Lines: 33788

💛 - Coveralls

src/dialect/mod.rs Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
src/ast/operator.rs Outdated Show resolved Hide resolved
@@ -1174,6 +1175,14 @@ impl<'a> Parser<'a> {
),
})
}
Token::ExclamationMark if !self.dialect.supports_factorial_operator() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Token::ExclamationMark if !self.dialect.supports_factorial_operator() => {
Token::ExclamationMark if self.dialect.supports_bang_not_operator() => {

See comment a bit lower for rationale to have a dedicated api for this behavior

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this comment looks unadressed? The new feature ideally has its own dialect method. Otherwise it can get complicated to try to infer when a feature should take precedence

Copy link
Author

Choose a reason for hiding this comment

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

The code has been re-pushed.

tests/sqlparser_hive.rs Outdated Show resolved Hide resolved
tests/sqlparser_hive.rs Outdated Show resolved Hide resolved
@wugeer
Copy link
Author

wugeer commented Oct 25, 2024

@iffyio Thank you for your suggestions—I learned a lot from them, I've resubmitted an updated version of the code. When you have a moment, could you please review it? Thanks!:)

@wugeer wugeer requested a review from iffyio October 25, 2024 14:35
src/parser/mod.rs Outdated Show resolved Hide resolved
src/ast/operator.rs Outdated Show resolved Hide resolved
@@ -1174,6 +1175,14 @@ impl<'a> Parser<'a> {
),
})
}
Token::ExclamationMark if !self.dialect.supports_factorial_operator() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this comment looks unadressed? The new feature ideally has its own dialect method. Otherwise it can get complicated to try to infer when a feature should take precedence

src/parser/mod.rs Outdated Show resolved Hide resolved
tests/sqlparser_hive.rs Outdated Show resolved Hide resolved
@wugeer wugeer requested a review from iffyio October 27, 2024 08:17
@wugeer wugeer force-pushed the fix_issue_1471 branch 2 times, most recently from de68644 to 99910dd Compare October 27, 2024 11:05
@wugeer
Copy link
Author

wugeer commented Oct 27, 2024

@iffyio Sorry, my oversight caused the code not to be merged. The code has been re-pushed.

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.

Hive should not successfully parse the factorial operator hive doesn't support !a expression
3 participants