You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/04/30 08:14:56 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #4177: [pulsar-clients]Support nested struct for GenericRecord

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:
users@infra.apache.org


With regards,
Apache Git Services