sijie commented on a change in pull request #4177: [pulsar-clients]Support 
nested struct for GenericRecord
URL: https://github.com/apache/pulsar/pull/4177#discussion_r279648266
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/FieldSchemaBuilderImpl.java
 ##########
 @@ -132,6 +141,10 @@ Field build() {
             case TIMESTAMP:
                 baseSchema = 
LogicalTypes.timestampMillis().addToSchema(Schema.create(Schema.Type.LONG));
                 break;
+            case AVRO:
+                GenericAvroSchema genericAvroSchema = (GenericAvroSchema) 
genericSchema;
 
 Review comment:
   You need to check if the `GenericSchema` is AVRO or not before casting it to 
`GenericAvroSchema`.
   
   ```
   checkArgument(genericSchema.getSchemaInfo().getSchemaType() == 
SchemaType.AVRO,
       "The field is expected to be using AVRO schema but " + 
genericSchema.getSchemaInfo().getSchemaType() + " schema is found");
   GenericAvroSchema genericAvroSchema = (GenericAvroSchema) genericSchema;
   ```

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


With regards,
Apache Git Services

Reply via email to