Skip to content

Commit f879f5d

Browse files
committed
redmine 31620 增加对unsigned类型支持
1 parent 0c8c5df commit f879f5d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

flinkx-core/src/main/java/com/dtstack/flinkx/constants/ConstantValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ConstantValue {
3939
public static final String RIGHT_PARENTHESIS_SYMBOL = ")";
4040

4141

42-
public static final String DATA_TYPE_UNSIGNED = "unsigned";
42+
public static final String DATA_TYPE_UNSIGNED = "UNSIGNED";
4343

4444

4545
public static final String KEY_HTTP = "http";

flinkx-core/src/main/java/com/dtstack/flinkx/enums/ColumnType.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import java.util.Arrays;
2525
import java.util.List;
26+
import java.util.Locale;
2627

2728
/**
2829
* Define standard column type for all the readers or writers that do not
@@ -82,11 +83,12 @@ public static ColumnType fromString(String type) {
8283
type = type.substring(0, type.indexOf(ConstantValue.LEFT_PARENTHESIS_SYMBOL));
8384
}
8485

86+
type = type.toUpperCase(Locale.ENGLISH);
8587
//为了支持无符号类型 如 int unsigned
86-
if(StringUtils.containsIgnoreCase(type,ConstantValue.DATA_TYPE_UNSIGNED)){
87-
type = type.replaceAll(ConstantValue.DATA_TYPE_UNSIGNED,"").trim();
88+
if(StringUtils.contains(type,ConstantValue.DATA_TYPE_UNSIGNED)){
89+
type = type.replace(ConstantValue.DATA_TYPE_UNSIGNED,"").trim();
8890
}
89-
return valueOf(type.toUpperCase());
91+
return valueOf(type);
9092
}
9193

9294
/**
@@ -95,16 +97,17 @@ public static ColumnType fromString(String type) {
9597
* @return
9698
*/
9799
public static ColumnType getType(String type){
100+
type = type.toUpperCase(Locale.ENGLISH);
98101
if(type.contains(ConstantValue.LEFT_PARENTHESIS_SYMBOL)){
99102
type = type.substring(0, type.indexOf(ConstantValue.LEFT_PARENTHESIS_SYMBOL));
100103
}
101104

102105
//为了支持无符号类型 如 int unsigned
103-
if(StringUtils.containsIgnoreCase(type,ConstantValue.DATA_TYPE_UNSIGNED)){
106+
if(StringUtils.contains(type,ConstantValue.DATA_TYPE_UNSIGNED)){
104107
type = type.replaceAll(ConstantValue.DATA_TYPE_UNSIGNED,"").trim();
105108
}
106109

107-
if(type.toLowerCase().contains(ColumnType.TIMESTAMP.name().toLowerCase())){
110+
if(type.contains(ColumnType.TIMESTAMP.name())){
108111
return TIMESTAMP;
109112
}
110113

0 commit comments

Comments
 (0)