jonvex commented on code in PR #10778:
URL: https://github.com/apache/hudi/pull/10778#discussion_r1543274055
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -963,15 +966,17 @@ private static Object
rewriteRecordWithNewSchemaInternal(Object oldRecord, Schem
}
return newRecord;
case ENUM:
- ValidationUtils.checkArgument(
- oldSchema.getType() == Schema.Type.STRING || oldSchema.getType()
== Schema.Type.ENUM,
- "Only ENUM or STRING type can be converted ENUM type");
+ if (oldSchema.getType() != Schema.Type.STRING && oldSchema.getType()
!= Schema.Type.ENUM) {
+ throw new SchemaCompatibilityException(String.format("Only ENUM or
STRING type can be converted ENUM type. Schema type was %s",
oldSchema.getType().getName()));
+ }
if (oldSchema.getType() == Schema.Type.STRING) {
return new GenericData.EnumSymbol(newSchema, oldRecord);
}
return oldRecord;
case ARRAY:
- ValidationUtils.checkArgument(oldRecord instanceof Collection, "cannot
rewrite record with different type");
+ if (!(oldRecord instanceof Collection)) {
Review Comment:
I think there are probably thousands of places in the codebase where we do
```
if (expression) {
throw new exception();
}
```
so don't think we should do this here
--
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]