Skip to content

Commit 86acbe2

Browse files
author
dujie
committed
hotfix【30201】从DB2到greenplum,如果是decimal类型且是整数类型支持插入到int类型字段中
1 parent 08e661a commit 86acbe2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flinkx-postgresql/flinkx-postgresql-core/src/main/java/com/dtstack/flinkx/postgresql/PostgresqlTypeConverter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.dtstack.flinkx.rdb.type.TypeConverterInterface;
2222
import org.apache.commons.lang3.StringUtils;
2323

24+
import java.math.BigDecimal;
2425
import java.util.Arrays;
2526
import java.util.Collections;
2627
import java.util.List;
@@ -65,6 +66,9 @@ public Object convert(Object data,String typeName) {
6566
}else if(byteTypes.contains(typeName)){
6667
data = Byte.valueOf(dataValue);
6768
} else if(intTypes.contains(typeName)){
69+
if(dataValue.contains(".")){
70+
dataValue = new BigDecimal(dataValue).stripTrailingZeros().toPlainString();
71+
}
6872
data = Integer.parseInt(dataValue);
6973
}
7074

0 commit comments

Comments
 (0)