@@ -579,7 +579,7 @@ public void testParquetInt96AsFixed12AvroType() throws Exception {
579579 enableInt96ReadingConfig .setBoolean (AvroReadSupport .READ_INT96_AS_FIXED , true );
580580
581581 Schema schema = Schema .createRecord ("myrecord" , null , null , false );
582- Schema int96schema = Schema .createFixed ("INT96 " , "INT96 represented as byte[12]" , null , 12 );
582+ Schema int96schema = Schema .createFixed ("int96_field " , "INT96 represented as byte[12]" , null , 12 );
583583 schema .setFields (Collections .singletonList (new Schema .Field ("int96_field" , int96schema , null , null )));
584584
585585 testParquetToAvroConversion (
@@ -599,6 +599,33 @@ public void testParquetInt96DefaultFail() throws Exception {
599599 () -> new AvroSchemaConverter ().convert (parquetSchemaWithInt96 ));
600600 }
601601
602+ @ Test
603+ public void testMultipleInt96FieldsToStringConversion () throws Exception {
604+ Configuration enableInt96ReadingConfig = new Configuration ();
605+ enableInt96ReadingConfig .setBoolean (AvroReadSupport .READ_INT96_AS_FIXED , true );
606+
607+ Types .MessageTypeBuilder builder = Types .buildMessage ();
608+ builder .optional (PrimitiveType .PrimitiveTypeName .INT96 ).named ("timestamp_1" );
609+ builder .optional (PrimitiveType .PrimitiveTypeName .INT96 ).named ("timestamp_2" );
610+ MessageType int96Schema = builder .named ("int96Schema" );
611+
612+ AvroSchemaConverter converter = new AvroSchemaConverter (enableInt96ReadingConfig );
613+ Schema avroSchema = converter .convert (int96Schema );
614+
615+ String schemaString = avroSchema .toString (true );
616+
617+ Assert .assertTrue (
618+ "First field should have full timestamp_1 definition" ,
619+ schemaString .contains ("\" name\" : \" timestamp_1\" " ));
620+ Assert .assertTrue (
621+ "Second field should have full timestamp_2 definition" ,
622+ schemaString .contains ("\" name\" : \" timestamp_2\" " ));
623+
624+ Assert .assertFalse (
625+ "Should not reference bare 'INT96' type anymore" ,
626+ schemaString .contains ("\" type\" : [ \" null\" , \" INT96\" ]" ));
627+ }
628+
602629 @ Test
603630 public void testDateType () throws Exception {
604631 Schema date = LogicalTypes .date ().addToSchema (Schema .create (INT ));
0 commit comments