Skip to content

Commit

Permalink
[Fix-1563] [metadata-mysql] NPE caused by querying data (#1564)
Browse files Browse the repository at this point in the history
Co-authored-by: wenmo <[email protected]>
  • Loading branch information
aiwenmo and aiwenmo authored Jan 15, 2023
1 parent 6a2ff0b commit 828012d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public ColumnType convert(Column column) {
if (Asserts.isNull(column)) {
return columnType;
}
String t = column.getType().toLowerCase();
Integer length = Asserts.isNull(column.getLength()) ? 0 : column.getLength();
String t = Asserts.isNull(column.getType()) ? "" : column.getType().toLowerCase();
boolean isNullable = !column.isKeyFlag() && column.isNullable();
if (t.contains("numeric") || t.contains("decimal")) {
columnType = ColumnType.DECIMAL;
Expand All @@ -59,7 +60,7 @@ public ColumnType convert(Column column) {
} else {
columnType = ColumnType.DOUBLE;
}
} else if (t.contains("boolean") || (t.contains("tinyint") && column.getLength() == 1) || t.contains("bit")) {
} else if (t.contains("boolean") || (t.contains("tinyint") && length.equals(1)) || t.contains("bit")) {
if (isNullable) {
columnType = ColumnType.JAVA_LANG_BOOLEAN;
} else {
Expand Down

0 comments on commit 828012d

Please sign in to comment.