-
-
Save jacobtolar/c88d43ab4e8767227891e5cdc188ffad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.avro.Schema; | |
import org.apache.avro.io.ResolvingDecoder; | |
import java.io.File; | |
import java.io.IOException; | |
public class Avro19Test { | |
public static void main(String[] argc) throws IOException { | |
Schema reader = new Schema.Parser().parse(new File("reader")); | |
Schema writer = new Schema.Parser().parse(new File("writer")); | |
ResolvingDecoder.resolve(writer, reader); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fields": [ { | |
"default": null, | |
"name": "r1", | |
"type": [ "null", { | |
"items": { | |
"fields": [ { "name": "num1", "type": "int" } ], | |
"name": "a1", | |
"namespace": "n1", | |
"type": "record" | |
}, | |
"type": "array" | |
} ] | |
} ], | |
"name": "f1", | |
"type": "record" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checking 1.9.0 | |
Exception in thread "main" java.lang.ClassCastException: org.apache.avro.Resolver$ReaderUnion cannot be cast to org.apache.avro.Resolver$Container | |
at org.apache.avro.io.parsing.ResolvingGrammarGenerator.generate(ResolvingGrammarGenerator.java:95) | |
at org.apache.avro.io.parsing.ResolvingGrammarGenerator.generate(ResolvingGrammarGenerator.java:110) | |
at org.apache.avro.io.parsing.ResolvingGrammarGenerator.generate(ResolvingGrammarGenerator.java:141) | |
at org.apache.avro.io.parsing.ResolvingGrammarGenerator.generate(ResolvingGrammarGenerator.java:65) | |
at org.apache.avro.io.ResolvingDecoder.resolve(ResolvingDecoder.java:85) | |
at Avro19Test.main(Avro19Test.java:11) | |
status=1 | |
checking 1.8.2 | |
status=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p 1.8.2 1.9.0 | |
wget --quiet 'https://repo1.maven.org/maven2/org/apache/avro/avro-tools/1.8.2/avro-tools-1.8.2.jar' -O 1.8.2/avro-tools.jar | |
wget --quiet 'https://repo1.maven.org/maven2/org/apache/avro/avro-tools/1.9.0/avro-tools-1.9.0.jar' -O 1.9.0/avro-tools.jar | |
echo checking 1.9.0 | |
javac -cp 1.9.0/* Avro19Test.java | |
java -cp 1.9.0/*:. Avro19Test | |
echo status=$? | |
echo checking 1.8.2 | |
javac -cp 1.8.2/* Avro19Test.java | |
java -cp 1.8.2/*:. Avro19Test | |
echo status=$? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fields": [ { | |
"default": null, | |
"name": "r1", | |
"type": [ "null", { | |
"items": { | |
"fields": [ { "name": "num1", "type": "int" } ], | |
"name": "a1", | |
"namespace": "n2", | |
"type": "record" | |
}, | |
"type": "array" | |
} ] | |
} ], | |
"name": "f1", | |
"type": "record" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment