iffyio commented on code in PR #2416:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2416#discussion_r3851603865
##########
src/ast/mod.rs:
##########
@@ -7544,34 +7544,22 @@ pub struct Grantee {
impl fmt::Display for Grantee {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self.grantee_type {
- GranteesType::Role => {
- write!(f, "ROLE ")?;
- }
- GranteesType::Share => {
- write!(f, "SHARE ")?;
- }
- GranteesType::User => {
- write!(f, "USER ")?;
- }
- GranteesType::Group => {
- write!(f, "GROUP ")?;
- }
- GranteesType::Public => {
- write!(f, "PUBLIC ")?;
- }
- GranteesType::DatabaseRole => {
- write!(f, "DATABASE ROLE ")?;
- }
- GranteesType::Application => {
- write!(f, "APPLICATION ")?;
- }
- GranteesType::ApplicationRole => {
- write!(f, "APPLICATION ROLE ")?;
+ let keyword = match self.grantee_type {
+ GranteesType::Role => "ROLE",
+ GranteesType::Share => "SHARE",
+ GranteesType::User => "USER",
+ GranteesType::Group => "GROUP",
+ GranteesType::Public => "PUBLIC",
+ GranteesType::DatabaseRole => "DATABASE ROLE",
+ GranteesType::Application => "APPLICATION",
+ GranteesType::ApplicationRole => "APPLICATION ROLE",
+ GranteesType::None => "",
+ };
+ f.write_str(keyword)?;
+ if let Some(name) = &self.name {
+ if !keyword.is_empty() {
+ f.write_str(" ")?;
Review Comment:
not sure I followed the diff correctly (the old and new code look identical
in terms of behavior), is the `PUBLIC` keyword is being handled differently
somehow?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]