LucaCappelletti94 commented on code in PR #2896:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2896#discussion_r4541976630


##########
tests/sqlparser_snowflake.rs:
##########
@@ -5042,3 +5030,34 @@ fn test_stage_name_delimiters() {
         ParserError::ParserError("Expected: stage name identifier, found: 
.".to_string()),
     );
 }
+
+#[test]
+fn test_select_wildcard_with_rename_before_replace() {
+    let canonical = snowflake_and_generic().verified_only_select(
+        "SELECT * REPLACE (a + 1 AS a) RENAME (a AS b) FROM (SELECT a FROM t)",
+    );
+    let reversed = snowflake_and_generic().verified_only_select_with_canonical(
+        "SELECT * RENAME (a AS b) REPLACE (a + 1 AS a) FROM (SELECT a FROM t)",
+        "SELECT * REPLACE (a + 1 AS a) RENAME (a AS b) FROM (SELECT a FROM t)",
+    );
+    assert_eq!(canonical, reversed);
+
+    let canonical = snowflake_and_generic().verified_only_select(
+        "SELECT * REPLACE (col_z || col_z AS col_z) RENAME (col_z AS col_zz) 
FROM data",
+    );
+    let reversed = snowflake_and_generic().verified_only_select_with_canonical(
+        "SELECT * RENAME (col_z AS col_zz) REPLACE (col_z || col_z AS col_z) 
FROM data",
+        "SELECT * REPLACE (col_z || col_z AS col_z) RENAME (col_z AS col_zz) 
FROM data",
+    );
+    assert_eq!(canonical, reversed);
+
+    assert_eq!(
+        snowflake_and_generic()
+            .parse_sql_statements(
+                "SELECT * REPLACE (a + 1 AS a) REPLACE (a + 2 AS a) FROM 
(SELECT a FROM t)"
+            )
+            .unwrap_err()
+            .to_string(),
+        "sql parser error: Expected: end of statement, found: REPLACE"

Review Comment:
   Use the typed error here instead to to_string.



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

Reply via email to