Skip to content

Commit 235dcc8

Browse files
committed
Merge branch '1.5_v3.6.0' into v1.5.0_dev
# Conflicts: # core/src/main/java/com/dtstack/flink/sql/Main.java # core/src/main/java/com/dtstack/flink/sql/side/SideSqlExec.java
2 parents 7ebe1c1 + 38f39fa commit 235dcc8

File tree

4 files changed

+61
-10
lines changed

4 files changed

+61
-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
.DS_Store
1516
bin/sideSql.txt

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.math.BigDecimal;
2424
import java.sql.Date;
25+
import java.sql.Time;
2526
import java.sql.Timestamp;
2627

2728
/**
@@ -35,38 +36,55 @@ public class ClassUtil {
3536
public static Class<?> stringConvertClass(String str) {
3637
switch (str.toLowerCase()) {
3738
case "boolean":
39+
case "bit":
3840
return Boolean.class;
3941

42+
case "smallint":
43+
case "smallintunsigned":
44+
case "tinyint":
45+
case "tinyintunsigned":
46+
case "mediumint":
47+
case "mediumintunsigned":
4048
case "integer":
4149
case "int":
4250
return Integer.class;
4351

44-
case "bigint":
45-
return Long.class;
46-
47-
case "tinyint":
52+
case "blob":
4853
return Byte.class;
4954

50-
case "smallint":
51-
return Short.class;
55+
case "bigint":
56+
case "intunsigned":
57+
case "integerunsigned":
58+
case "bigintunsigned":
59+
return Long.class;
5260

5361
case "varchar":
62+
case "char":
63+
case "text":
5464
return String.class;
5565

5666
case "real":
5767
case "float":
68+
case "realunsigned":
69+
case "floatunsigned":
5870
return Float.class;
5971

6072
case "double":
73+
case "doubleunsigned":
6174
return Double.class;
6275

6376
case "date":
6477
return Date.class;
6578

79+
case "datetime":
6680
case "timestamp":
6781
return Timestamp.class;
6882

83+
case "time":
84+
return Time.class;
85+
6986
case "decimal":
87+
case "decimalunsigned":
7088
return BigDecimal.class;
7189

7290
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ public static List<String> splitIgnoreQuota(String str, char delimiter){
5757
List<String> tokensList = new ArrayList<>();
5858
boolean inQuotes = false;
5959
boolean inSingleQuotes = false;
60+
int bracketLeftNum = 0;
6061
StringBuilder b = new StringBuilder();
6162
for (char c : str.toCharArray()) {
6263
if(c == delimiter){
6364
if (inQuotes) {
6465
b.append(c);
6566
} else if(inSingleQuotes){
6667
b.append(c);
68+
} else if(bracketLeftNum > 0){
69+
b.append(c);
6770
}else {
6871
tokensList.add(b.toString());
6972
b = new StringBuilder();
@@ -74,6 +77,12 @@ public static List<String> splitIgnoreQuota(String str, char delimiter){
7477
}else if(c == '\''){
7578
inSingleQuotes = !inSingleQuotes;
7679
b.append(c);
80+
}else if(c == '('){
81+
bracketLeftNum++;
82+
b.append(c);
83+
}else if(c == ')'){
84+
bracketLeftNum--;
85+
b.append(c);
7786
}else{
7887
b.append(c);
7988
}

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,52 @@ public class SwitchUtil {
3030
public static Object getTarget(Object obj, String targetType) {
3131
targetType = targetType.toLowerCase();
3232
switch (targetType) {
33-
case "int":
33+
34+
case "smallint":
35+
case "smallintunsigned":
36+
case "tinyint":
37+
case "tinyintunsigned":
38+
case "mediumint":
39+
case "mediumintunsigned":
3440
case "integer":
41+
case "int":
3542
return MathUtil.getIntegerVal(obj);
43+
3644
case "bigint":
45+
case "intunsigned":
46+
case "integerunsigned":
3747
return MathUtil.getLongVal(obj);
48+
3849
case "boolean":
3950
return MathUtil.getBoolean(obj);
40-
case "tinyint":
51+
52+
case "blob":
4153
return MathUtil.getByte(obj);
42-
case "smallint":
43-
return MathUtil.getShort(obj);
54+
4455
case "varchar":
56+
case "char":
57+
case "text":
4558
return MathUtil.getString(obj);
59+
4660
case "real":
4761
case "float":
62+
case "realunsigned":
63+
case "floatunsigned":
4864
return MathUtil.getFloatVal(obj);
65+
4966
case "double":
67+
case "doubleunsigned":
5068
return MathUtil.getDoubleVal(obj);
69+
5170
case "decimal":
71+
case "decimalunsigned":
5272
return MathUtil.getBigDecimal(obj);
73+
5374
case "date":
5475
return MathUtil.getDate(obj);
76+
5577
case "timestamp":
78+
case "datetime":
5679
return MathUtil.getTimestamp(obj);
5780
}
5881
return obj;

0 commit comments

Comments
 (0)