xitep commented on code in PR #2101:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2101#discussion_r2588422199


##########
tests/sqlparser_common.rs:
##########
@@ -10072,6 +10079,53 @@ fn test_merge_with_delimiter() {
     }
 }
 
+#[test]
+fn test_merge_with_predicates() {
+    let sql = "\
+MERGE INTO FOO \
+USING FOO_IMPORT \
+ON (FOO.ID = FOO_IMPORT.ID) \
+WHEN MATCHED THEN \
+UPDATE SET FOO.NAME = FOO_IMPORT.NAME \
+WHERE 1 = 1 \
+DELETE WHERE FOO.NAME LIKE '%.DELETE' \
+WHEN NOT MATCHED THEN \
+INSERT (ID, NAME) \
+VALUES (FOO_IMPORT.ID, UPPER(FOO_IMPORT.NAME)) \
+WHERE NOT FOO_IMPORT.NAME LIKE '%.DO_NOT_INSERT'";
+    all_dialects().verified_stmt(sql);

Review Comment:
   ok, i've put them together into `test_merge`.
   
   but, quite honestly, i believe this rather a negative; it's quite 
frustrating to make changes and rely on the extensive test suite, only to get a 
...
   ```
   ...
   ---- parse_merge stdout ----
   
   thread 'parse_merge' (1824796) panicked at src/test_utils.rs:166:13:
   assertion `left == right` failed
     left: "MERGE INTO PLAYGROUND .FOO USING FOO_IMPORT ON (PLAYGROUND.FOO.ID = 
FOO_IMPORT.ID) WHEN NOT MATCHED THEN INSERT (PLAYGROUND.FOO.ID, 
PLAYGROUND.FOO.NAME) VALUES (1, 'abc')"
    right: "MERGE INTO PLAYGROUND.FOO USING FOO_IMPORT ON (PLAYGROUND.FOO.ID = 
FOO_IMPORT.ID) WHEN NOT MATCHED THEN INSERT (PLAYGROUND.FOO.ID, 
PLAYGROUND.FOO.NAME) VALUES (1, 'abc')"
   ...
   ```
   
   ... and then have to find out which assertion the change broke since 
`test_utils.rs:166`) simply is not helpful (the best chance is to re-run the 
tests with RUST_BACKTRACE=1 or ...=full.)



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