Repository navigation
Commit 68ac6cc
authored
fix: unparse Int8 casts as SIGNED for MySQL dialect (apache#26883)
## Which issue does this PR close?
- Closes apache#26882.
## Rationale for this change
MySQL's `CAST` does not accept `TINYINT` as a target type, so an `Int8`
cast unparsed with `MySqlDialect` produces SQL that MySQL rejects with
`ERROR 1064`.
See
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast
## What changes are included in this PR?
`MySqlDialect` overrides `int8_cast_dtype` to return `SIGNED`, like the
existing `int32_cast_dtype` and `int64_cast_dtype` overrides.
## What is the testing strategy for this PR?
New unit test `mysql_int8_cast_uses_signed` in
`datafusion/sql/src/unparser/expr.rs`.
## Are there any user-facing changes?
No API changes.1 parent 10fb070 commit 68ac6cc
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
588 | 592 | | |
589 | 593 | | |
590 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3144 | 3144 | | |
3145 | 3145 | | |
3146 | 3146 | | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
3147 | 3156 | | |
3148 | 3157 | | |
3149 | 3158 | | |
| |||
0 commit comments