Skip to content

Commit 5d502e8

Browse files
committed
[hotfix-#1002][hive] Fix the cast-exception of converting the decimal data, and the IllegalArgumentException when writing decimal data into parquet file.
1 parent 048d796 commit 5d502e8

File tree

2 files changed

+438
-3
lines changed
  • chunjun-connectors/chunjun-connector-hdfs/src/main/java/com/dtstack/chunjun/connector/hdfs/sink
  • flinkx-connectors/flinkx-connector-hive/src/main/java/com/dtstack/flinkx/connector/hive/util

2 files changed

+438
-3
lines changed

chunjun-connectors/chunjun-connector-hdfs/src/main/java/com/dtstack/chunjun/connector/hdfs/sink/HdfsParquetOutputFormat.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,12 @@ private MessageType buildSchema() {
225225
String colType = fullColumnTypeList.get(i).toLowerCase(Locale.ENGLISH);
226226
int left = colType.indexOf(ConstantValue.LEFT_PARENTHESIS_SYMBOL);
227227
int right = colType.indexOf(ConstantValue.RIGHT_PARENTHESIS_SYMBOL);
228+
boolean isDecimalType = ColumnTypeUtil.isDecimalType(colType);
229+
String tempType = colType;
228230
if (left > 0 && right > 0) {
229-
colType = colType.substring(0, left);
231+
tempType = colType.substring(0, left);
230232
}
231-
switch (colType) {
233+
switch (tempType) {
232234
case "tinyint":
233235
case "smallint":
234236
case "int":
@@ -267,7 +269,7 @@ private MessageType buildSchema() {
267269
.named(name);
268270
break;
269271
default:
270-
if (ColumnTypeUtil.isDecimalType(colType)) {
272+
if (isDecimalType) {
271273
ColumnTypeUtil.DecimalInfo decimalInfo =
272274
ColumnTypeUtil.getDecimalInfo(
273275
colType, PARQUET_DEFAULT_DECIMAL_INFO);

0 commit comments

Comments
 (0)