kbuci commented on code in PR #18958:
URL: https://github.com/apache/hudi/pull/18958#discussion_r3406675281


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/util/RowDataToAvroConverters.java:
##########
@@ -148,6 +148,14 @@ public Object convert(HoodieSchema schema, Object object) {
 
               @Override
               public Object convert(HoodieSchema schema, Object object) {
+                // The BLOB `type` discriminator is a STRING in Flink but an 
ENUM in Avro.
+                // Detect that at call time from the HoodieSchema so the 
converter stays
+                // reusable across any row shape — not hard-wired by Flink row 
structure alone.
+                if (schema.getNonNullType().getType() == 
HoodieSchemaType.ENUM) {
+                  HoodieSchema enumSchema = schema.getNonNullType();
+                  return new GenericData.EnumSymbol(
+                      enumSchema.toAvroSchema(), ((BinaryStringData) 
object).toString());

Review Comment:
   Good point, let me drop unnecessary cast 



-- 
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]

Reply via email to