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

Support Snowflake - allow number as placeholder (e.g. :1) #1001

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

yuval-illumex
Copy link
Contributor

The following query is valid in snowflake:

SELECT :1 from table

@coveralls
Copy link

coveralls commented Oct 12, 2023

Pull Request Test Coverage Report for Build 6639508164

  • 11 of 12 (91.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 87.427%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 4 5 80.0%
Totals Coverage Status
Change from base Build 6631977604: 0.01%
Covered Lines: 17085
Relevant Lines: 19542

💛 - Coveralls

Copy link
Contributor

@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.

Thank you @yuval-illumex

src/parser/mod.rs Outdated Show resolved Hide resolved
@yuval-illumex
Copy link
Contributor Author

@alamb I add failed test and refactored the PR to identify numbers only within placeholder.
I would appreciate your feedback!

Copy link
Contributor

@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.

Thank you @yuval-illumex -- this makes sense to me

@@ -4759,7 +4759,14 @@ impl<'a> Parser<'a> {
Token::HexStringLiteral(ref s) => Ok(Value::HexStringLiteral(s.to_string())),
Token::Placeholder(ref s) => Ok(Value::Placeholder(s.to_string())),
tok @ Token::Colon | tok @ Token::AtSign => {
let ident = self.parse_identifier()?;
// Not calling self.parse_identifier()? because only in placeholder we want to check numbers as idfentifies
Copy link
Contributor

@alamb alamb Oct 25, 2023

Choose a reason for hiding this comment

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

✅ makes sense to me

Suggested change
// Not calling self.parse_identifier()? because only in placeholder we want to check numbers as idfentifies
// Not calling self.parse_identifier()? because only in placeholder we want to check numbers as identifiers

@alamb alamb changed the title Snowflake - allow number as placeholder Support Snowflake - allow number as placeholder (:1) Oct 25, 2023
@alamb alamb changed the title Support Snowflake - allow number as placeholder (:1) Support Snowflake - allow number as placeholder (e.g. :1) Oct 25, 2023
@alamb alamb merged commit 65317ed into apache:main Oct 25, 2023
10 checks passed
serprex pushed a commit to serprex/sqlparser-rs that referenced this pull request Nov 6, 2023
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