hozan23 opened a new issue, #26882:
URL: https://github.com/apache/datafusion/issues/26882

   ### Describe the bug
   
   `MySqlDialect` overrides `int32_cast_dtype` and `int64_cast_dtype` to return 
`SIGNED`, but does not override `int8_cast_dtype`. An `Int8` cast therefore 
unparses with the default `TINYINT`.
   
   MySQL's `CAST` does not accept `TINYINT` as a target type (see the 
[permitted 
types](https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast)).
   
   ### To Reproduce
   
     ```rust
     let unparser = Unparser::new(&MySqlDialect {});
     let expr = Expr::Cast(Cast::new(Box::new(col("a")), DataType::Int8));
     println!("{}", unparser.expr_to_sql(&expr)?);
     // CAST(`a` AS TINYINT)
    ```
   
   
   ### Expected behavior
   
   CAST(`a` AS SIGNED), the same as `Int32` and `Int64` casts.
   
   ### Additional context
   
   _No response_
   
   ### Willingness to contribute
   
   I plan to contribute a fix for this bug independently


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to