[fix](catalog)paimon support more data type (#22899)

This commit is contained in:
zhangdong
2023-08-14 13:48:33 +08:00
committed by GitHub
parent d371101bfd
commit fa6110accd
10 changed files with 212 additions and 175 deletions

View File

@ -268,6 +268,7 @@ public class ColumnType {
type = Type.DATEV2;
break;
case "binary":
case "bytes":
type = Type.BINARY;
break;
case "string":
@ -279,27 +280,27 @@ public class ColumnType {
precision = 6; // default
Matcher match = digitPattern.matcher(lowerCaseType);
if (match.find()) {
precision = Integer.parseInt(match.group(1));
precision = Integer.parseInt(match.group(1).trim());
}
} else if (lowerCaseType.startsWith("char")) {
Matcher match = digitPattern.matcher(lowerCaseType);
if (match.find()) {
type = Type.CHAR;
length = Integer.parseInt(match.group(1));
length = Integer.parseInt(match.group(1).trim());
}
} else if (lowerCaseType.startsWith("varchar")) {
Matcher match = digitPattern.matcher(lowerCaseType);
if (match.find()) {
type = Type.VARCHAR;
length = Integer.parseInt(match.group(1));
length = Integer.parseInt(match.group(1).trim());
}
} else if (lowerCaseType.startsWith("decimal")) {
int s = lowerCaseType.indexOf('(');
int e = lowerCaseType.indexOf(')');
if (s != -1 && e != -1) {
String[] ps = lowerCaseType.substring(s + 1, e).split(",");
precision = Integer.parseInt(ps[0]);
scale = Integer.parseInt(ps[1]);
precision = Integer.parseInt(ps[0].trim());
scale = Integer.parseInt(ps[1].trim());
if (lowerCaseType.startsWith("decimalv2")) {
type = Type.DECIMALV2;
} else if (lowerCaseType.startsWith("decimal32")) {