xiarixiaoyao commented on a change in pull request #4421:
URL: https://github.com/apache/hudi/pull/4421#discussion_r773694729
##########
File path:
hudi-flink/src/main/java/org/apache/hudi/util/AvroSchemaConverter.java
##########
@@ -244,10 +244,13 @@ public static Schema convertToSchema(LogicalType
logicalType, String rowName) {
return nullable ? nullableSchema(time) : time;
case DECIMAL:
DecimalType decimalType = (DecimalType) logicalType;
- // store BigDecimal as byte[]
+ // store BigDecimal as Fixed
+ // for spark compatibility.
Schema decimal =
LogicalTypes.decimal(decimalType.getPrecision(),
decimalType.getScale())
- .addToSchema(SchemaBuilder.builder().bytesType());
+ .addToSchema(SchemaBuilder
+ .fixed(String.format("%s.fixed", rowName))
+
.size(computeMinBytesForDecimlPrecision(decimalType.getPrecision())));
Review comment:
Yes, hive can be read directly. Hive has good compatibility. Forgive me,
I can't take a screenshot here because of the company's regulations
Spark saves decimal as int / long / byte [] / fixed according to precision,
of which the fourth is the most compatible。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]