You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "guan404ming (via GitHub)" <gi...@apache.org> on 2026/02/08 12:46:00 UTC

[PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

guan404ming opened a new pull request, #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210

   ## Why                                                                                                                             
                                                                                                                                   
   MSSQL's WAITFOR statement (DELAY/TIME) was not supported by the parser.                                                         
                                                                                                                                 
   ## How                                                                                                                             
                                                                                                                  
   - Add WaitForStatement and WaitForType AST nodes for DELAY and TIME variants                                         
   - Parse WAITFOR { DELAY | TIME } <expr> in the MSSQL dialect
   - Add DELAY and WAITFOR keywords, tests for all variants and error cases


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio commented on code in PR #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210#discussion_r2807131022


##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
     );
 }
 
+#[test]
+fn test_parse_waitfor() {
+    // WAITFOR DELAY
+    let sql = "WAITFOR DELAY '00:00:05'";
+    let stmt = ms().verified_stmt(sql);

Review Comment:
   ```suggestion
       let stmt = ms_and_generic().verified_stmt(sql);
   ```
   Can we have the tests cover the [generic syntax](https://github.com/apache/datafusion-sqlparser-rs?tab=readme-ov-file#new-syntax)?



-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio merged PR #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210#issuecomment-3920953912

   Thanks for nice catch @iffyio. Both ot them could be generic, just updated!


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on code in PR #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210#discussion_r2808741578


##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
     );
 }
 
+#[test]
+fn test_parse_waitfor() {
+    // WAITFOR DELAY
+    let sql = "WAITFOR DELAY '00:00:05'";
+    let stmt = ms().verified_stmt(sql);

Review Comment:
   Sure, I just updated. Thanks!



-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] MSSQL: Add support for WAITFOR statement [datafusion-sqlparser-rs]

Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio commented on code in PR #2210:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2210#discussion_r2821252792


##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
     );
 }
 
+#[test]
+fn test_parse_waitfor() {
+    // WAITFOR DELAY
+    let sql = "WAITFOR DELAY '00:00:05'";
+    let stmt = ms_and_generic().verified_stmt(sql);
+    assert_eq!(
+        stmt,
+        Statement::WaitFor(WaitForStatement {
+            wait_type: WaitForType::Delay,
+            expr: Expr::Value(
+                (Value::SingleQuotedString("00:00:05".to_string())).with_empty_span()
+            ),
+        })
+    );
+
+    // WAITFOR TIME
+    let sql = "WAITFOR TIME '14:30:00'";
+    let stmt = ms_and_generic().verified_stmt(sql);
+    assert_eq!(
+        stmt,
+        Statement::WaitFor(WaitForStatement {
+            wait_type: WaitForType::Time,
+            expr: Expr::Value(
+                (Value::SingleQuotedString("14:30:00".to_string())).with_empty_span()
+            ),
+        })
+    );
+
+    // WAITFOR DELAY with variable
+    let sql = "WAITFOR DELAY @WaitTime";
+    let _ = ms().verified_stmt(sql);

Review Comment:
   ```suggestion
       let _ = ms_and_generic().verified_stmt(sql);
   ```
   these as well can cover generic?



##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
     );
 }
 
+#[test]
+fn test_parse_waitfor() {
+    // WAITFOR DELAY
+    let sql = "WAITFOR DELAY '00:00:05'";
+    let stmt = ms_and_generic().verified_stmt(sql);
+    assert_eq!(
+        stmt,
+        Statement::WaitFor(WaitForStatement {
+            wait_type: WaitForType::Delay,
+            expr: Expr::Value(
+                (Value::SingleQuotedString("00:00:05".to_string())).with_empty_span()
+            ),
+        })
+    );
+
+    // WAITFOR TIME
+    let sql = "WAITFOR TIME '14:30:00'";
+    let stmt = ms_and_generic().verified_stmt(sql);
+    assert_eq!(
+        stmt,
+        Statement::WaitFor(WaitForStatement {
+            wait_type: WaitForType::Time,
+            expr: Expr::Value(
+                (Value::SingleQuotedString("14:30:00".to_string())).with_empty_span()
+            ),
+        })
+    );
+
+    // WAITFOR DELAY with variable
+    let sql = "WAITFOR DELAY @WaitTime";
+    let _ = ms().verified_stmt(sql);
+
+    // Error: WAITFOR without DELAY or TIME
+    let res = ms().parse_sql_statements("WAITFOR '00:00:05'");

Review Comment:
   ```suggestion
       let res = ms_and_generic().parse_sql_statements("WAITFOR '00:00:05'");
   ```



-- 
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-unsubscribe@datafusion.apache.org

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


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