Database Reference
In-Depth Information
file created earlier, using the SortedStringPair.avsc schema to sort by the right field in
descending order. First, we inspect the input using the Avro tools JAR:
% java -jar $AVRO_HOME/avro-tools-*.jar tojson input/avro/pairs.avro
{"left":"a","right":"1"}
{"left":"c","right":"2"}
{"left":"b","right":"3"}
{"left":"b","right":"2"}
Then we run the sort:
% hadoop jar avro-examples.jar AvroSort input/avro/pairs.avro output
\
ch12-avro/src/main/resources/SortedStringPair.avsc
Finally, we inspect the output and see that it is sorted correctly:
% java -jar $AVRO_HOME/avro-tools-*.jar tojson output/
part-r-00000.avro
{"left":"b","right":"3"}
{"left":"b","right":"2"}
{"left":"c","right":"2"}
{"left":"a","right":"1"}
Search WWH ::




Custom Search