Skip to content

Commit 3440b9f

Browse files
committed
Merge branch '1.5_v3.6.0_bugfix' into '1.5_v3.6.0'
unsigned字段解析 smallintunsigned tinyintunsigned mediumintunsigned 转为Java Int See merge request !36
2 parents 4516be9 + 9956a1b commit 3440b9f

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ target/
1010
plugins/
1111
lib/
1212
.vertx/
13+
.DS_Store
1314
bin/nohup.out
1415

1516
bin/sideSql.txt

core/src/main/java/com/dtstack/flink/sql/util/ClassUtil.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ public static Class<?> stringConvertClass(String str) {
3939
case "bit":
4040
return Boolean.class;
4141

42+
case "smallint":
43+
case "smallintunsigned":
44+
case "tinyint":
45+
case "tinyintunsigned":
46+
case "mediumint":
47+
case "mediumintunsigned":
4248
case "integer":
4349
case "int":
44-
case "mediumint":
45-
case "tinyint":
4650
return Integer.class;
4751

4852
case "blob":
@@ -51,21 +55,22 @@ public static Class<?> stringConvertClass(String str) {
5155
case "bigint":
5256
case "intunsigned":
5357
case "integerunsigned":
58+
case "bigintunsigned":
5459
return Long.class;
5560

56-
case "smallint":
57-
return Short.class;
58-
5961
case "varchar":
6062
case "char":
6163
case "text":
6264
return String.class;
6365

6466
case "real":
6567
case "float":
68+
case "realunsigned":
69+
case "floatunsigned":
6670
return Float.class;
6771

6872
case "double":
73+
case "doubleunsigned":
6974
return Double.class;
7075

7176
case "date":
@@ -79,6 +84,7 @@ public static Class<?> stringConvertClass(String str) {
7984
return Time.class;
8085

8186
case "decimal":
87+
case "decimalunsigned":
8288
return BigDecimal.class;
8389

8490
}

rdb/rdb-side/src/main/java/com/dtstack/flink/sql/side/rdb/util/SwitchUtil.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ public static Object getTarget(Object obj, String targetType) {
3131
targetType = targetType.toLowerCase();
3232
switch (targetType) {
3333

34+
case "smallint":
35+
case "smallintunsigned":
3436
case "tinyint":
35-
case "int":
36-
case "integer":
37+
case "tinyintunsigned":
3738
case "mediumint":
39+
case "mediumintunsigned":
40+
case "integer":
41+
case "int":
3842
return MathUtil.getIntegerVal(obj);
3943

4044
case "bigint":
@@ -48,22 +52,23 @@ public static Object getTarget(Object obj, String targetType) {
4852
case "blob":
4953
return MathUtil.getByte(obj);
5054

51-
case "smallint":
52-
return MathUtil.getShort(obj);
53-
5455
case "varchar":
5556
case "char":
5657
case "text":
5758
return MathUtil.getString(obj);
5859

5960
case "real":
6061
case "float":
62+
case "realunsigned":
63+
case "floatunsigned":
6164
return MathUtil.getFloatVal(obj);
6265

6366
case "double":
67+
case "doubleunsigned":
6468
return MathUtil.getDoubleVal(obj);
6569

6670
case "decimal":
71+
case "decimalunsigned":
6772
return MathUtil.getBigDecimal(obj);
6873

6974
case "date":

0 commit comments

Comments
 (0)