STET

agent_patch

runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-2151/flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch

4762 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/data_type.rs b/app/src/ast/data_type.rs
index 285eec5..7efc475 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/data_type.rs
+++ b/app/src/ast/data_type.rs
@@ -719,6 +719,7 @@ impl fmt::Display for DataType {
                 ArrayElemTypeDef::SquareBracket(t, Some(size)) => write!(f, "{t}[{size}]"),
                 ArrayElemTypeDef::AngleBracket(t) => write!(f, "ARRAY<{t}>"),
                 ArrayElemTypeDef::Parenthesis(t) => write!(f, "Array({t})"),
+                ArrayElemTypeDef::TypeSuffix(t) => write!(f, "{t} ARRAY"),
             },
             DataType::Custom(ty, modifiers) => {
                 if modifiers.is_empty() {
@@ -1146,6 +1147,8 @@ pub enum ArrayElemTypeDef {
     SquareBracket(Box<DataType>, Option<u64>),
     /// Parenthesis style, e.g. `Array(Int64)`.
     Parenthesis(Box<DataType>),
+    /// Suffix style that appends `ARRAY` after the element type, e.g. `INT ARRAY`.
+    TypeSuffix(Box<DataType>),
 }
 
 /// Represents different types of geometric shapes which are commonly used in
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mod.rs b/app/src/dialect/mod.rs
index 284fc41..62f8ce7 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mod.rs
+++ b/app/src/dialect/mod.rs
@@ -908,6 +908,14 @@ pub trait Dialect: Debug + Any {
         false
     }
 
+    /// Returns true if this dialect supports a trailing `ARRAY` keyword on
+    /// `CAST(expr AS type ARRAY)` expressions.
+    ///
+    /// [MySQL](https://dev.mysql.com/doc/refman/8.4/en/create-table-fts.html#functional-indexes-multi-valued)
+    fn supports_cast_array_suffix(&self) -> bool {
+        false
+    }
+
     /// Returns true if this dialect supports extra parentheses around
     /// lone table names or derived tables in the `FROM` clause.
     ///
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mysql.rs b/app/src/dialect/mysql.rs
index 81aa9d4..36a6f72 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mysql.rs
+++ b/app/src/dialect/mysql.rs
@@ -168,6 +168,10 @@ impl Dialect for MySqlDialect {
         true
     }
 
+    fn supports_cast_array_suffix(&self) -> bool {
+        true
+    }
+
     fn supports_cross_join_constraint(&self) -> bool {
         true
     }
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/parser/mod.rs b/app/src/parser/mod.rs
index cfc173d..8c713be 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/parser/mod.rs
+++ b/app/src/parser/mod.rs
@@ -2654,7 +2654,15 @@ impl<'a> Parser<'a> {
         self.expect_token(&Token::LParen)?;
         let expr = self.parse_expr()?;
         self.expect_keyword_is(Keyword::AS)?;
-        let data_type = self.parse_data_type()?;
+        let mut data_type = self.parse_data_type()?;
+        if self
+            .dialect
+            .supports_cast_array_suffix()
+            && self.parse_keyword(Keyword::ARRAY)
+        {
+            data_type =
+                DataType::Array(ArrayElemTypeDef::TypeSuffix(Box::new(data_type)));
+        }
         let format = self.parse_optional_cast_format()?;
         self.expect_token(&Token::RParen)?;
         Ok(Expr::Cast {
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs b/app/tests/sqlparser_mysql.rs
index e847d3e..c3619f2 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs
+++ b/app/tests/sqlparser_mysql.rs
@@ -4096,6 +4096,25 @@ fn parse_cast_integers() {
         .expect_err("CAST doesn't allow display width");
 }
 
+#[test]
+fn parse_cast_array_suffix() {
+    mysql().verified_expr("CAST(foo AS SIGNED ARRAY)");
+    mysql().verified_expr("CAST(foo AS SIGNED INTEGER ARRAY)");
+
+    let expr = mysql().verified_expr("CAST(foo AS UNSIGNED INTEGER ARRAY)");
+    match expr {
+        Expr::Cast { data_type, .. } => {
+            assert_eq!(
+                data_type,
+                DataType::Array(ArrayElemTypeDef::TypeSuffix(Box::new(
+                    DataType::UnsignedInteger
+                )))
+            );
+        }
+        other => panic!("Expected CAST expression, got {other:?}"),
+    }
+}
+
 #[test]
 fn parse_match_against_with_alias() {
     let sql = "SELECT tbl.ProjectID FROM surveys.tbl1 AS tbl WHERE MATCH (tbl.ReferenceID) AGAINST ('AAA' IN BOOLEAN MODE)";