Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pint merge 7.3.x to 7.4.x #3521

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,41 @@ public void testEnumWithDefault() throws Exception {
assertNotEquals(new AvroSchema(enumSchema), new AvroSchema(enumSchemaWithDefault));
}

@Test
public void testArrayWithDoc() {
String s1 = "\n"
+ "{\n"
+ " \"type\": \"array\",\n"
+ " \"items\": { \n"
+ " \"type\": \"record\",\n"
+ " \"name\": \"top\",\n"
+ " \"doc\": \"test\",\n"
+ " \"fields\": [\n"
+ " {\n"
+ " \"name\": \"field1\",\n"
+ " \"type\": \"string\"\n"
+ " }\n"
+ " ]\n"
+ " }\n"
+ "}";
String s2 = "\n"
+ "{\n"
+ " \"type\": \"array\",\n"
+ " \"items\": { \n"
+ " \"type\": \"record\",\n"
+ " \"name\": \"top\",\n"
+ " \"doc\": \"test2\",\n"
+ " \"fields\": [\n"
+ " {\n"
+ " \"name\": \"field1\",\n"
+ " \"type\": \"string\"\n"
+ " }\n"
+ " ]\n"
+ " }\n"
+ "}";
assertNotEquals(new AvroSchema(s1), new AvroSchema(s2));
}

@Test
public void testBasicAddAndRemoveTags() {
String schemaString = "{\n" +
Expand Down Expand Up @@ -1170,7 +1205,6 @@ public void testTagsInsertionOrder() {

ParsedSchema resultSchema = schema.copy(tags, Collections.emptyMap());
assertEquals(expectSchema.canonicalString(), resultSchema.canonicalString());

}

private static void expectConversionException(JsonNode obj, AvroSchema schema) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ private boolean metaEqual(
return Objects.equals(schema1.getAliases(), schema2.getAliases())
&& Objects.equals(schema1.getDoc(), schema2.getDoc())
&& Objects.equals(schema1.getEnumDefault(), schema2.getEnumDefault());
case ARRAY:
return metaEqual(schema1.getElementType(), schema2.getElementType(), cache);
case MAP:
return metaEqual(schema1.getValueType(), schema2.getValueType(), cache);
case FIXED:
return Objects.equals(schema1.getAliases(), schema2.getAliases())
&& Objects.equals(schema1.getDoc(), schema2.getDoc());
Expand Down Expand Up @@ -473,6 +477,10 @@ private int metaHash(Schema schema, Map<Schema, Integer> cache) {
return result;
case ENUM:
return Objects.hash(schema.getAliases(), schema.getDoc(), schema.getEnumDefault());
case ARRAY:
return metaHash(schema.getElementType(), cache);
case MAP:
return metaHash(schema.getValueType(), cache);
case FIXED:
return Objects.hash(schema.getAliases(), schema.getDoc());
case UNION:
Expand Down