[mysql] Add note for MySQL TINYINT(1) type to Flink SQL Boolean type

This closes #2030.
pull/1984/head^2
Hang Ruan 2 years ago committed by GitHub
parent 85af8894ce
commit 07e4722456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -106,6 +106,10 @@ public class MySqlTypeUtils {
String typeName = column.typeName();
switch (typeName) {
case TINYINT:
// MySQL haven't boolean type, it uses tinyint(1) to represents boolean type
// user should not use tinyint(1) to store number although jdbc url parameter
// tinyInt1isBit=false can help change the return value, it's not a general way
// btw: mybatis and mysql-connector-java map tinyint(1) to boolean by default
return column.length() == 1 ? DataTypes.BOOLEAN() : DataTypes.TINYINT();
case TINYINT_UNSIGNED:
case TINYINT_UNSIGNED_ZEROFILL:

Loading…
Cancel
Save