You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "nryanov (via GitHub)" <gi...@apache.org> on 2023/07/27 01:29:20 UTC
[GitHub] [avro] nryanov commented on a diff in pull request #2396: AVRO-2539: fix nullable types for avro to thrift
nryanov commented on code in PR #2396:
URL: https://github.com/apache/avro/pull/2396#discussion_r1275634526
##########
lang/java/thrift/src/test/java/org/apache/avro/thrift/TestThrift.java:
##########
@@ -93,4 +101,38 @@ private void check(Test test) throws Exception {
assertEquals(test, o);
}
+
+ @org.junit.jupiter.api.Test
+ public void complexStructTest() {
+ Schema schema = ThriftData.get().getSchema(Test.class);
+
+ Schema intOptional = Schema.createUnion(Schema.create(Schema.Type.NULL), Schema.create(Schema.Type.INT));
+ Schema stringSchema = Schema.create(Schema.Type.STRING);
+ stringSchema.addProp("avro.java.string", "String");
+ stringSchema = Schema.createUnion(Schema.create(Schema.Type.NULL), stringSchema);
+
+ Schema stringOptionalDefaultValue = Schema.create(Schema.Type.STRING);
+ stringOptionalDefaultValue.addProp("avro.java.string", "String");
+ stringOptionalDefaultValue = Schema.createUnion(stringOptionalDefaultValue, Schema.create(Schema.Type.NULL));
+
+ Schema longSchema = Schema.create(Schema.Type.LONG);
+
+ assertEquals(schema.getField("i32Field").schema(), intOptional);
+ assertEquals(schema.getField("stringField").schema(), stringSchema);
+ assertEquals(schema.getField("stringOptionalFieldWithDefault").schema(), stringOptionalDefaultValue);
+ assertEquals(schema.getField("i64Field").schema(), longSchema);
+ }
+
+ @org.junit.jupiter.api.Test
+ public void testBackwardCompatibility() {
Review Comment:
Additional test that verify that actual fix works in terms of compatibility
--
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org