Skip to content

Commit dad20fe

Browse files
committed
add method normalizeDecimalPrecisionAndScale()
1 parent 5652993 commit dad20fe

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

tis-datax/tis-ds-mysql-v5-plugin/src/main/java/com/qlangtech/tis/plugin/ds/mysql/MySQLV5DataSourceFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public JDBCConnection createConnection(String jdbcUrl, Optional<Properties> prop
5757
if (this.password != null) {
5858
info.put("password", this.password);
5959
}
60-
info.put("serverTimezone", Objects.requireNonNull(this.timeZone, "timeZone can not be null").getTimeZone().getId());
60+
if(this.timeZone != null){
61+
info.put("serverTimezone", Objects.requireNonNull(this.timeZone, "timeZone can not be null").getTimeZone().getId());
62+
}
63+
6164
if (verify) {
6265
info.put("connectTimeout", "3000");
6366
info.put("socketTimeout", "3000");

tis-incr/tis-realtime-flink/src/main/java/com/qlangtech/tis/plugins/incr/flink/cdc/BasicFlinkDataMapper.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ public FlinkCol bigInt(DataType type) {
219219

220220

221221
public FlinkCol decimalType(DataType type) {
222-
223-
int precision = type.getColumnSize();
224-
Integer scale = type.getDecimalDigits();
225-
if (precision < 1 || precision > DataTypeMeta.DEFAULT_DECIMAL_PRECISION) {
226-
precision = DataTypeMeta.DEFAULT_DECIMAL_PRECISION;
227-
}
222+
int[] normalize = DataTypeMeta.normalizeDecimalPrecisionAndScale(type);
223+
int precision = normalize[0];// type.getColumnSize();
224+
Integer scale = normalize[1];// type.getDecimalDigits();
225+
// if (precision < 1 || precision > DataTypeMeta.DEFAULT_DECIMAL_PRECISION) {
226+
// precision = DataTypeMeta.DEFAULT_DECIMAL_PRECISION;
227+
// }
228228
try {
229229
return new FlinkCol(meta, type, //DataTypes.DECIMAL(precision, scale)
230230
new AtomicDataType(new DecimalType(nullable, precision, scale))

0 commit comments

Comments
 (0)