doris boolean类型为何通过jdbc转为了bit而非tinyint?

Viewed 34

我们使用了doris推荐的mysql-connector-java:8.0.25从doris里面读取数据,但是却把boolean转成了bit。我在fe的类型转换中发现的却是boolean会转化成tinyint,是否有人帮忙答一下疑?
public MysqlColType toMysqlType() {
switch (this) {
// MySQL use Tinyint(1) to represent boolean
case BOOLEAN:
case TINYINT:
return MysqlColType.MYSQL_TYPE_TINY;
case SMALLINT:
return MysqlColType.MYSQL_TYPE_SHORT;
case INT:
return MysqlColType.MYSQL_TYPE_LONG;
case BIGINT:
return MysqlColType.MYSQL_TYPE_LONGLONG;
case LARGEINT:
if (Config.use_mysql_bigint_for_largeint) {
return MysqlColType.MYSQL_TYPE_LONGLONG;
} else {
return MysqlColType.MYSQL_TYPE_STRING;
}

1 Answers

BIT类型取值范围更合适,且占用空间小。
如果可以解答你的问题的话,辛苦点一下采纳