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


##########
tests/sqlparser_common.rs:
##########
@@ -15982,3 +15992,64 @@ fn parse_create_procedure_with_parameter_modes() {
         _ => unreachable!(),
     }
 }
+
+#[test]
+fn test_select_exclude() {
+    let dialects = all_dialects_where(|d| 
d.supports_select_wildcard_exclude());
+    match &dialects
+        .verified_only_select("SELECT * EXCLUDE c1 FROM test")
+        .projection[0]
+    {
+        SelectItem::Wildcard(WildcardAdditionalOptions { opt_exclude, .. }) => 
{
+            assert_eq!(
+                *opt_exclude,
+                Some(ExcludeSelectItem::Single(Ident::new("c1")))
+            );
+        }
+        _ => unreachable!(),
+    }
+    match &dialects
+        .verified_only_select("SELECT * EXCLUDE (c1, c2) FROM test")
+        .projection[0]
+    {
+        SelectItem::Wildcard(WildcardAdditionalOptions { opt_exclude, .. }) => 
{
+            assert_eq!(
+                *opt_exclude,
+                Some(ExcludeSelectItem::Multiple(vec![
+                    Ident::new("c1"),
+                    Ident::new("c2")
+                ]))
+            );
+        }
+        _ => unreachable!(),
+    }
+    let select = dialects.verified_only_select("SELECT * EXCLUDE c1, c2 FROM 
test");
+    match &select.projection[0] {
+        SelectItem::Wildcard(WildcardAdditionalOptions { opt_exclude, .. }) => 
{
+            assert_eq!(
+                *opt_exclude,
+                Some(ExcludeSelectItem::Single(Ident::new("c1")))
+            );
+        }
+        _ => unreachable!(),
+    }
+    match &select.projection[1] {
+        SelectItem::UnnamedExpr(Expr::Identifier(ident)) => {
+            assert_eq!(*ident, Ident::new("c2"));
+        }
+        _ => unreachable!(),
+    }
+
+    let dialects = all_dialects_where(|d| d.supports_select_exclude());

Review Comment:
   Could we add a test with
   ```rust
   let dialects = all_dialects_where(|d| d.supports_select_wildcard_exclude() 
&& !d.supports_select_exclude());
   ```
   like in snowflake's case to demonstrate the behavior when there is e.g. an 
exclude that is an ident `SELECT *, EXCLUDE c1 FROM test` or similar



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