You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/02/14 06:56:17 UTC

(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2207-4b4a9d7411f7a855999069e6a0d10202cdcab7b9 created (now 6a48f44f)

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch gh-readonly-queue/main/pr-2207-4b4a9d7411f7a855999069e6a0d10202cdcab7b9
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


      at 6a48f44f Updated `parse_infix(..)` in `mysql.rs` and `sqlite.rs` to handle error rather than `unwrap()` (#2207)

This branch includes the following new commits:

     new 6a48f44f Updated `parse_infix(..)` in `mysql.rs` and `sqlite.rs` to handle error rather than `unwrap()` (#2207)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


(datafusion-sqlparser-rs) 01/01: Updated `parse_infix(..)` in `mysql.rs` and `sqlite.rs` to handle error rather than `unwrap()` (#2207)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch gh-readonly-queue/main/pr-2207-4b4a9d7411f7a855999069e6a0d10202cdcab7b9
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit 6a48f44f99d015a4f7a86275e2521ea2cc45fdae
Author: Alex <45...@users.noreply.github.com>
AuthorDate: Sat Feb 14 14:55:57 2026 +0800

    Updated `parse_infix(..)` in `mysql.rs` and `sqlite.rs` to handle error rather than `unwrap()` (#2207)
---
 src/dialect/mysql.rs     | 9 +++++++--
 tests/sqlparser_mysql.rs | 8 ++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/dialect/mysql.rs b/src/dialect/mysql.rs
index 51a43f89..b31a2310 100644
--- a/src/dialect/mysql.rs
+++ b/src/dialect/mysql.rs
@@ -102,10 +102,15 @@ impl Dialect for MySqlDialect {
     ) -> Option<Result<crate::ast::Expr, ParserError>> {
         // Parse DIV as an operator
         if parser.parse_keyword(Keyword::DIV) {
+            let left = Box::new(expr.clone());
+            let right = Box::new(match parser.parse_expr() {
+                Ok(expr) => expr,
+                Err(e) => return Some(Err(e)),
+            });
             Some(Ok(Expr::BinaryOp {
-                left: Box::new(expr.clone()),
+                left,
                 op: BinaryOperator::MyIntegerDivide,
-                right: Box::new(parser.parse_expr().unwrap()),
+                right,
             }))
         } else {
             None
diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
index 1b9d12f8..4ad0404b 100644
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -3627,6 +3627,14 @@ fn parse_div_infix() {
     mysql().verified_stmt(r#"SELECT 5 DIV 2"#);
 }
 
+#[test]
+fn parse_div_infix_propagates_parse_error() {
+    let err = mysql()
+        .parse_sql_statements("SELECT 5 DIV")
+        .expect_err("expected an error");
+    assert_matches!(err, ParserError::ParserError(_));
+}
+
 #[test]
 fn parse_drop_temporary_table() {
     let sql = "DROP TEMPORARY TABLE foo";


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