You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Christopher Cooper (JIRA)" <ji...@apache.org> on 2010/07/01 21:41:49 UTC

[jira] Created: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
---------------------------------------------------------------------------------------------------------------------------------------

                 Key: AVRO-589
                 URL: https://issues.apache.org/jira/browse/AVRO-589
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.3.3
            Reporter: Christopher Cooper
             Fix For: 1.3.3


I've got a complicated schema that when deserializing data gives me the following exception:

java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)


If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.

I can send all files and unit tests needed to duplicate the error to whomever is working this ticket



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


[jira] Updated: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-589:
-------------------------------------

          Status: Resolved  (was: Patch Available)
    Hadoop Flags: [Reviewed]
      Resolution: Fixed

Committed revision 960427.

Thanks Scott for reviewing the patch.

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.4.0
>
>         Attachments: AVRO-589.patch
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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


[jira] Assigned: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. reassigned AVRO-589:
----------------------------------------

    Assignee: Thiruvalluvan M. G.

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.3
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.3.3
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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


[jira] Updated: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-589:
-------------------------------------

               Status: Patch Available  (was: Open)
    Affects Version/s: 1.3.2
                       1.3.1
                       1.3.0
                       1.2.0
        Fix Version/s: 1.4.0
                           (was: 1.3.3)

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.0
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.4.0
>
>         Attachments: AVRO-589.patch
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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


[jira] Commented: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884395#action_12884395 ] 

Thiruvalluvan M. G. commented on AVRO-589:
------------------------------------------

Hi Christopher Cooper,

Thanks for reporting this bug. If it is okay to publicly share, please attach you test data, schemas and unit tests to this JIRA. Otherwise, please send them to my e-mail id.

Thanks

Thiru

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.3
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.3.3
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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


[jira] Commented: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Scott Carey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885001#action_12885001 ] 

Scott Carey commented on AVRO-589:
----------------------------------

+1 this looks good to me.  The test looks good and demonstrates the issue.  The fix works.  

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.4.0
>
>         Attachments: AVRO-589.patch
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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


[jira] Updated: (AVRO-589) ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-589:
-------------------------------------

    Attachment: AVRO-589.patch

Here is a patch that has:
   - A test that demonstrates the bug
   - The fix for the bug

The problem was with union fields that are present in writer's schema but not in reader's schema. The ResolvingGrammerGenerator correctly generates a skip action for such fields. The skip action should have a UnionAdjustAction, but instead has a "Alternate" symbol. This is because we by mistake used to call the base super.generate(). The fix is to use an identity resolver for the union.

> ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-589
>                 URL: https://issues.apache.org/jira/browse/AVRO-589
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.3
>            Reporter: Christopher Cooper
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.3.3
>
>         Attachments: AVRO-589.patch
>
>
> I've got a complicated schema that when deserializing data gives me the following exception:
> java.lang.ClassCastException: org.apache.avro.io.parsing.Symbol$Alternative cannot be cast to org.apache.avro.io.parsing.Symbol$UnionAdjustAction
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:188)
> 	at org.apache.avro.io.ParsingDecoder.skipTopSymbol(ParsingDecoder.java:66)
> 	at org.apache.avro.io.parsing.SkipParser.skipTo(SkipParser.java:71)
> 	at org.apache.avro.io.parsing.SkipParser.skipSymbol(SkipParser.java:93)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:207)
> 	at org.apache.avro.io.parsing.Parser.processImplicitActions(Parser.java:116)
> 	at org.apache.avro.io.ResolvingDecoder.drain(ResolvingDecoder.java:141)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:195)
> 	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:182)
> If I go into  ResolvingDecoder.readIndex and modify the code to use an instanceof check, my data deserializes perfectly fine.
> I can send all files and unit tests needed to duplicate the error to whomever is working this ticket

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