iffyio commented on code in PR #1974:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1974#discussion_r2231404829


##########
src/ast/mod.rs:
##########
@@ -3704,6 +3704,20 @@ pub enum Statement {
         history: bool,
         show_options: ShowStatementOptions,
     },
+    // ```sql
+    // SHOW {CHARACTER SET | CHARSET} [like_or_where]
+    // ```
+    // where:
+    // like_or_where: {
+    //     LIKE 'pattern'
+    //   | WHERE expr
+    // }
+    // MySQL specific statement
+    // 
<https://dev.mysql.com/doc/refman/8.4/en/show.html#:~:text=SHOW%20%7BCHARACTER%20SET%20%7C%20CHARSET%7D%20%5Blike_or_where%5D>
+    ShowCharset {
+        is_shorthand: bool,
+        filter: Option<ShowStatementFilter>,
+    },

Review Comment:
   Can we switch to using a named struct syntax for this statement? [See 
ref](https://github.com/apache/datafusion-sqlparser-rs/issues/1204) we're 
trying to move away from the anonymous struct syntax ideally.
   
   We could have something like?
   ```rust
   struct ShowCharSet { ... }
   Statement::ShowCharSet(ShowCharSet{...})
   ```
   



##########
src/ast/mod.rs:
##########
@@ -3704,6 +3704,20 @@ pub enum Statement {
         history: bool,
         show_options: ShowStatementOptions,
     },
+    // ```sql
+    // SHOW {CHARACTER SET | CHARSET} [like_or_where]
+    // ```
+    // where:
+    // like_or_where: {
+    //     LIKE 'pattern'
+    //   | WHERE expr
+    // }
+    // MySQL specific statement
+    // 
<https://dev.mysql.com/doc/refman/8.4/en/show.html#:~:text=SHOW%20%7BCHARACTER%20SET%20%7C%20CHARSET%7D%20%5Blike_or_where%5D>

Review Comment:
   ```suggestion
       // 
    [MySQL]: 
https://dev.mysql.com/doc/refman/8.4/en/show.html#:~:text=SHOW%20%7BCHARACTER%20SET%20%7C%20CHARSET%7D%20%5Blike_or_where%5D
   ```
   
   Or something similar, essentially dropping the mention of it being mysql 
specific, since that can change in the future or other existing dialects might 
also support it in some form



##########
tests/sqlparser_mysql.rs:
##########
@@ -4143,3 +4143,11 @@ fn parse_json_member_of() {
         _ => panic!("Unexpected statement {stmt}"),
     }
 }
+
+#[test]
+fn parse_show_charset() {
+    let _ = mysql().verified_stmt("SHOW CHARACTER SET");

Review Comment:
   Since this adds a new node to the AST, can we assert one of the scenarios 
that the AST looks as expected? [For 
example](https://github.com/apache/datafusion-sqlparser-rs/blob/4a533132b58090512c03337111925f8bc7098e97/tests/sqlparser_mysql.rs#L88-L98)



##########
src/ast/mod.rs:
##########
@@ -3704,6 +3704,20 @@ pub enum Statement {
         history: bool,
         show_options: ShowStatementOptions,
     },
+    // ```sql
+    // SHOW {CHARACTER SET | CHARSET} [like_or_where]
+    // ```
+    // where:
+    // like_or_where: {
+    //     LIKE 'pattern'
+    //   | WHERE expr
+    // }

Review Comment:
   ```suggestion
       // SHOW {CHARACTER SET | CHARSET}
       // ```
   ```
   Thinking a brief example would be enough. For detailed syntax readers can 
follow the documentation



##########
src/ast/mod.rs:
##########
@@ -3704,6 +3704,20 @@ pub enum Statement {
         history: bool,
         show_options: ShowStatementOptions,
     },
+    // ```sql
+    // SHOW {CHARACTER SET | CHARSET} [like_or_where]
+    // ```
+    // where:
+    // like_or_where: {
+    //     LIKE 'pattern'
+    //   | WHERE expr
+    // }
+    // MySQL specific statement
+    // 
<https://dev.mysql.com/doc/refman/8.4/en/show.html#:~:text=SHOW%20%7BCHARACTER%20SET%20%7C%20CHARSET%7D%20%5Blike_or_where%5D>
+    ShowCharset {
+        is_shorthand: bool,

Review Comment:
   Could we add a description what this flag does?



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to