-
Notifications
You must be signed in to change notification settings - Fork 603
Use dialects in the parser for support snowflake aliasing syntax #244
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::dialect::Dialect; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct SnowflakeDialect; | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like the new dialect (including a separate test file), the dialect-specific parsing infrastructure, and the table factor parsing fix to be landed separately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean by different PR's or commits ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant PRs. |
||
|
||
impl Dialect for SnowflakeDialect { | ||
//Revisit: currently copied from Genric dialect | ||
fn is_identifier_start(&self, ch: char) -> bool { | ||
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_' || ch == '#' || ch == '@' | ||
} | ||
|
||
//Revisit: currently copied from Genric dialect | ||
fn is_identifier_part(&self, ch: char) -> bool { | ||
(ch >= 'a' && ch <= 'z') | ||
|| (ch >= 'A' && ch <= 'Z') | ||
|| (ch >= '0' && ch <= '9') | ||
|| ch == '@' | ||
|| ch == '$' | ||
|| ch == '#' | ||
|| ch == '_' | ||
} | ||
|
||
fn alllow_single_table_in_parenthesis(&self) -> bool { | ||
true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note #241 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry :| - I don't understand what you mean by that ..
(to note #241 in code comment ? or something in the code is not aligned with what you commented in #241 (comment) )
Can you please elborate ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that comment I tried to argue for using
if self.dialect <is snowflake>
checks rather thanself.dialect.alllow_single_table_in_parenthesis()
, at least until we better understand when to use which approach.