Details
Description
Right now the exception that's thrown when a reader and written schema don't match (while reading a file), looks like this:
Found {"type":"record","name":"Test","fields":[{"name":"stringField","type":"string"},{"name":"longField","type":"long"}]}, expecting {"type":"record","name":"Test1","fields":[{"name":"stringField","type":"string"},{"name":"longField","type":"long"}]}
While this is perfectly okay for small schema with a few fields, it gets hard to debug for complex and large ones.
The attached patch changes the exception message to look like:
Found { "type" : "record", "name" : "Test", "fields" : [ { "name" : "stringField", "type" : "string" }, { "name" : "longField", "type" : "long" } ] }, expecting { "type" : "record", "name" : "Test1", "fields" : [ { "name" : "stringField", "type" : "string" }, { "name" : "longField", "type" : "long" } ] }
P.s. Ideally a diff-like message would help too, but its mileage may vary. I guess with the pretty output printed, a user may easily do a diff (since they now have newlines), so us providing this is not really needed.