-
Notifications
You must be signed in to change notification settings - Fork 606
Support Map literal syntax for DuckDB and Generic #1344
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
Conversation
Gentle ping @alamb |
This is interesting PR. |
Sorry -- I am behind on reviews. I triggered the worflow |
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.
Thank you @goldmedal and @dharanad
src/parser/mod.rs
Outdated
@@ -1078,6 +1078,9 @@ impl<'a> Parser<'a> { | |||
let expr = self.parse_subexpr(Self::PLUS_MINUS_PREC)?; | |||
Ok(Expr::Prior(Box::new(expr))) | |||
} | |||
Keyword::MAP if self.peek_token() == Token::LBrace => { |
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.
Should this also check dialect.support_map_literal_syntax()
?
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.
Sounds great. Thanks
Pull Request Test Coverage Report for Build 10027832349Warning: 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
💛 - Coveralls |
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.
Looks good to me -- thanks you @goldmedal
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.
LGTM!
src/ast/mod.rs
Outdated
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] | ||
pub struct Map { | ||
pub fields: Vec<MapField>, |
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.
pub fields: Vec<MapField>, | |
pub entries: Vec<MapEntry>, |
we can probably use entry since field could be confused for the key part of the map?
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.
Thanks @iffyio. Sounds great!
Thank you @goldmedal and @iffyio I plan a release early this upcoming week for another reason, so this should be available shortly |
Description
I added Map syntax of DuckDB for
DuckDB
andGeneric
dialects.For example:
It will also be used by apache/datafusion#11434 for creating the scalar map.