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


##########
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:
   can we merge the test cases into the same test function e.g. `fn 
test_merge()`? since they belong to the same feature



##########
src/parser/merge.rs:
##########
@@ -0,0 +1,242 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! SQL Parser for MERGE
+
+#[cfg(not(feature = "std"))]
+use alloc::{boxed::Box, format, string::ToString, vec, vec::Vec};
+
+use crate::{
+    ast::{
+        Merge, MergeAction, MergeClause, MergeClauseKind, MergeInsertExpr, 
MergeInsertKind,
+        MergeUpdateExpr, ObjectName, OutputClause, SetExpr, Statement,
+    },
+    dialect::{BigQueryDialect, GenericDialect, MySqlDialect},
+    keywords::Keyword,
+    parser::IsOptional,
+    tokenizer::TokenWithSpan,
+};
+
+use super::{Parser, ParserError};
+
+impl Parser<'_> {
+    /// Parse a MERGE statement, returning a `Box`ed SetExpr

Review Comment:
   ```suggestion
       /// Parse a `MERGE` statement, returning a `Box`ed SetExpr
   ```



##########
src/parser/merge.rs:
##########
@@ -0,0 +1,242 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! SQL Parser for MERGE

Review Comment:
   ```suggestion
   //! SQL Parser for a `MERGE` statement
   ```



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