Hi,

When I run the code below the output indicates that these two are
incompatible in terms of schema evolution.

The ONLY difference is the namespace (v1 and v2).

If I remove the namespace line the are reported as 'compatible'.

My question is why these two are considered to be incompatible?


@Test
public void evolveTest() throws IOException {
  Schema schemaV1 = new Schema.Parser().parse("{\n" +
    "  \"type\" : \"record\",\n" +
    "  \"name\" : \"Foo\",\n" +
    "  \"namespace\" : \"nl.example.evoleschema.v1\",\n" +
    "  \"fields\" : [ {\n" +
    "    \"name\" : \"count\",\n" +
    "    \"type\" : {\n" +
    "      \"type\" : \"enum\",\n" +
    "      \"name\" : \"Bar\",\n" +
    "      \"symbols\" : [ \"ONE\", \"TWO\", \"THREE\" ]\n" +
    "    }\n" +
    "  } ]\n" +
    "}");

  Schema schemaV2 = new Schema.Parser().parse("{\n" +
    "  \"type\" : \"record\",\n" +
    "  \"name\" : \"Foo\",\n" +
    "  \"namespace\" : \"nl.example.evoleschema.v2\",\n" +
    "  \"fields\" : [ {\n" +
    "    \"name\" : \"count\",\n" +
    "    \"type\" : {\n" +
    "      \"type\" : \"enum\",\n" +
    "      \"name\" : \"Bar\",\n" +
    "      \"symbols\" : [ \"ONE\", \"TWO\", \"THREE\" ]\n" +
    "    }\n" +
    "  } ]\n" +
    "}");

  LOG.info("{}",
SchemaCompatibility.checkReaderWriterCompatibility(schemaV1,
schemaV2).getType());
  LOG.info("{}",
SchemaCompatibility.checkReaderWriterCompatibility(schemaV2,
schemaV1).getType());
}

-- 
Best regards / Met vriendelijke groeten,

Niels Basjes

Reply via email to