agent_patch
runs/2026-02-28__18-27-22__gpt-5-1-codex-mini/flux-pr-2151/flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/agent-logs/agent.patch
4748 bytes
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/ast/data_type.rs b/app/src/ast/data_type.rs
index 285eec5..282be2b 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__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::KeywordSuffix(t) => write!(f, "{t} ARRAY"),
},
DataType::Custom(ty, modifiers) => {
if modifiers.is_empty() {
@@ -1133,7 +1134,8 @@ impl fmt::Display for BinaryLength {
/// Represents the data type of the elements in an array (if any) as well as
/// the syntax used to declare the array.
///
-/// For example: Bigquery/Hive use `ARRAY<INT>` whereas snowflake uses ARRAY.
+/// For example: Bigquery/Hive use `ARRAY<INT>` whereas snowflake uses ARRAY,
+/// and MySQL allows an `ARRAY` keyword as a suffix (`INT ARRAY`).
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
@@ -1146,6 +1148,8 @@ pub enum ArrayElemTypeDef {
SquareBracket(Box<DataType>, Option<u64>),
/// Parenthesis style, e.g. `Array(Int64)`.
Parenthesis(Box<DataType>),
+ /// Keyword suffix style, e.g. `INT ARRAY`.
+ KeywordSuffix(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-28__18-27-22__gpt-5-1-codex-mini/app/src/dialect/mod.rs b/app/src/dialect/mod.rs
index 284fc41..7a3981b 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/dialect/mod.rs
+++ b/app/src/dialect/mod.rs
@@ -1185,6 +1185,11 @@ pub trait Dialect: Debug + Any {
fn supports_array_typedef_with_brackets(&self) -> bool {
false
}
+ /// Returns true if the dialect allows an `ARRAY` keyword after another
+ /// type, for example `CAST(col AS CHAR(10) ARRAY)`.
+ fn supports_array_typedef_with_keyword_suffix(&self) -> bool {
+ false
+ }
/// Returns true if the dialect supports geometric types.
///
/// Postgres: <https://www.postgresql.org/docs/9.5/functions-geometry.html>
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/dialect/mysql.rs b/app/src/dialect/mysql.rs
index 81aa9d4..314cb19 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/dialect/mysql.rs
+++ b/app/src/dialect/mysql.rs
@@ -138,6 +138,10 @@ impl Dialect for MySqlDialect {
true
}
+ fn supports_array_typedef_with_keyword_suffix(&self) -> bool {
+ true
+ }
+
fn is_table_factor_alias(&self, explicit: bool, kw: &Keyword, _parser: &mut Parser) -> bool {
explicit
|| (!keywords::RESERVED_FOR_TABLE_ALIAS.contains(kw)
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/parser/mod.rs b/app/src/parser/mod.rs
index cfc173d..3bed707 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/src/parser/mod.rs
+++ b/app/src/parser/mod.rs
@@ -11905,6 +11905,14 @@ impl<'a> Parser<'a> {
data = DataType::Array(ArrayElemTypeDef::SquareBracket(Box::new(data), size))
}
}
+ if self
+ .dialect
+ .supports_array_typedef_with_keyword_suffix()
+ {
+ while self.parse_keyword(Keyword::ARRAY) {
+ data = DataType::Array(ArrayElemTypeDef::KeywordSuffix(Box::new(data)));
+ }
+ }
Ok((data, trailing_bracket))
}
diff --git a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs b/app/tests/sqlparser_mysql.rs
index e847d3e..f02b6bf 100644
--- a/tmp/agent-patch-flux-pr-2151.1-of-1.2026-02-28__18-27-22__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs
+++ b/app/tests/sqlparser_mysql.rs
@@ -4096,6 +4096,11 @@ fn parse_cast_integers() {
.expect_err("CAST doesn't allow display width");
}
+#[test]
+fn parse_cast_with_array_suffix() {
+ mysql().verified_expr("CAST(foo AS CHAR(10) ARRAY)");
+}
+
#[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)";