You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2010/10/29 23:32:21 UTC

[jira] Resolved: (AVRO-642) Prettify the json dumped during exceptions while validating a writer/reader schema

     [ https://issues.apache.org/jira/browse/AVRO-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting resolved AVRO-642.
-------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]

I committed this.  Thanks, Harsh.

> Prettify the json dumped during exceptions while validating a writer/reader schema
> ----------------------------------------------------------------------------------
>
>                 Key: AVRO-642
>                 URL: https://issues.apache.org/jira/browse/AVRO-642
>             Project: Avro
>          Issue Type: Improvement
>          Components: java, python
>    Affects Versions: 1.3.3
>         Environment: Avro-Trunk
>            Reporter: Harsh J Chouraria
>            Assignee: Harsh J Chouraria
>            Priority: Minor
>             Fix For: 1.5.0
>
>         Attachments: avro.java.schema.pretty.r1.diff, avro.py.schema.pretty.r1.diff, avro.schema.pretty.r2.diff, avro.schema.pretty.r3.diff, avro.schema.pretty.r4.diff, avro.schema.pretty.r5.diff
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Right now the exception that's thrown when a reader and written schema don't match (while reading a file), looks like this:
> {noformat}
> 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"}]}
> {noformat}
> 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:
> {noformat}
> 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"
>   } ]
> }
> {noformat}
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.