zhedoubushishi commented on a change in pull request #1953:
URL: https://github.com/apache/hudi/pull/1953#discussion_r476901023
##########
File path: hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java
##########
@@ -433,23 +434,46 @@ private static Object
convertValueForSpecificDataTypes(Schema fieldSchema, Objec
return fieldValue;
}
- if (isLogicalTypeDate(fieldSchema)) {
- return LocalDate.ofEpochDay(Long.parseLong(fieldValue.toString()));
+ if (fieldSchema.getType() == Schema.Type.UNION) {
+ for (Schema schema : fieldSchema.getTypes()) {
+ if (schema.getType() != Schema.Type.NULL) {
Review comment:
For schema like:
```
{
"name":"event_cost3",
"type":[
"null",
{
"type":"fixed",
"name":"dc",
"size":5,
"logicalType":"decimal",
"precision":10,
"scale":6
}
]
```
or
```
{
"name":"event_date3",
"type":[
"null",
{
"type":"int",
"logicalType":"date"
}
]
```
The first schema it gets is null, w/o this condition, it will directly
return the fieldValue w/o any special conversion. BTW this comment remind me to
add another test case for decimal type with union.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]