You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "iffyio (via GitHub)" <gi...@apache.org> on 2025/02/25 06:57:41 UTC

Re: [PR] Parse signed/unsigned integer data type in MySQL CAST [datafusion-sqlparser-rs]

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


##########
src/ast/data_type.rs:
##########
@@ -238,6 +238,26 @@ pub enum DataType {
     UnsignedBigInt(Option<u64>),
     /// Unsigned Int8 with optional display width e.g. INT8 UNSIGNED or INT8(11) UNSIGNED
     UnsignedInt8(Option<u64>),
+    /// Signed integer as used in [MySQL CAST] target types, with optional `INTEGER` suffix:
+    /// `SIGNED [INTEGER]`
+    ///
+    /// Note that this doesn't accept a display width and is reversed from the syntax used in column
+    /// definitions ([`DataType::Int`]): `INTEGER [SIGNED]`
+    ///
+    /// Semantically equivalent to `BIGINT`.
+    ///
+    /// [MySQL CAST]: https://dev.mysql.com/doc/refman/8.4/en/cast-functions.html
+    Signed(bool),

Review Comment:
   thinking it feels a unexpected to use `Signed(true)` to represent `SIGNED INTEGER`? and the repr assumes  a mysql-only type which might not be the case going forward. Feels like it'd be clear to represent them explicitly as `SIGNED` and `SIGNED INTEGER` where both can be reused by other dialects later if needed?



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