You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Patrick Hunt (JIRA)" <ji...@apache.org> on 2009/11/18 06:54:40 UTC

[jira] Created: (AVRO-208) java specific compiler doesn't check for ambiguous enums

java specific compiler doesn't check for ambiguous enums
--------------------------------------------------------

                 Key: AVRO-208
                 URL: https://issues.apache.org/jira/browse/AVRO-208
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.2.0
            Reporter: Patrick Hunt


the java specific compiler flags ambiguous unions but not enums

      "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},


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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801990#action_12801990 ] 

Doug Cutting commented on AVRO-208:
-----------------------------------

> Must enums have at at least one symbol?

I can't think of a reason to require that, can you?  Java permits empty enums.  I don't know about other languages.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Updated: (AVRO-208) java specific compiler doesn't check for ambiguous enums

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

Doug Cutting updated AVRO-208:
------------------------------

    Component/s:     (was: java)
                 spec

Well, we could declare that duplicate symbols are allowed, and that references should resolve to the first instance or somesuch.  But that would be silly.  So disallowing them in the spec is probably best, and it would be best if implementations checked this.  So the problem is more general than Java's specific compiler.  The schema parser/constructor for each implementation should check for duplicate symbols.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829406#action_12829406 ] 

Philip Zeyliger commented on AVRO-208:
--------------------------------------

Still +1 on the patch.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12779636#action_12779636 ] 

Doug Cutting commented on AVRO-208:
-----------------------------------

Is this a spec issue?  Should we clarify that such enums are illegal, as we have for unions?

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828205#action_12828205 ] 

Doug Cutting commented on AVRO-208:
-----------------------------------

> ValidatingEncoder/Decoder and ResolvingDecoder will have problem with empty enums.

It is impossible to serialize an empty enum with any encoder/decoder, no?  But automated code might generate, e.g., an empty enum in a union with null, and only ever emit the null.  So having a schema with an empty enum is currently possible, but reading or writing a value whose type is an empty enum will always fail.  Does the value of catching this earlier, at schema parse time, outweigh the cost of prohibiting empty enums in contexts where they're not read or written?  I don't feel strongly one way or the other.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Updated: (AVRO-208) java specific compiler doesn't check for ambiguous enums

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

Doug Cutting updated AVRO-208:
------------------------------

    Attachment: AVRO-208.patch

Here's a patch that prohibits duplicate enum symbols in the spec and in Java.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Updated: (AVRO-208) java specific compiler doesn't check for ambiguous enums

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

Doug Cutting updated AVRO-208:
------------------------------

    Fix Version/s: 1.3.0
         Assignee: Doug Cutting
           Status: Patch Available  (was: Open)

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801997#action_12801997 ] 

Philip Zeyliger commented on AVRO-208:
--------------------------------------

You can't instantiate an empty enum in any meaningful way, can you?  I guess that's not a problem for us, since if you can't instantiate it, you don't have to worry about serializing it :).

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801984#action_12801984 ] 

Philip Zeyliger commented on AVRO-208:
--------------------------------------

+1.

Must enums have at at least one symbol?  You could add that while you were at it if you wanted to, but the patch looks good as is.

-- Philip

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

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

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

ValidatingEncoder/Decoder and ResolvingDecoder will have problem with empty enums. The encoder/decoder will expect a call to write/read enum. But with every value, it'll throw an error stating the value is invalid. I guess GenericDatumWriter/Reader will have the problem as well.

I think it's best not to allow empty enums.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Updated: (AVRO-208) java specific compiler doesn't check for ambiguous enums

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

Doug Cutting updated AVRO-208:
------------------------------

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

I just committed this.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-208.patch
>
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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


[jira] Commented: (AVRO-208) java specific compiler doesn't check for ambiguous enums

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12779730#action_12779730 ] 

Patrick Hunt commented on AVRO-208:
-----------------------------------

How could it be otw? Is it ever legal to have dup symbols in an enum? It's fine w/me if you want to explicitly list it in
the spec and also have the code check for this.

> java specific compiler doesn't check for ambiguous enums
> --------------------------------------------------------
>
>                 Key: AVRO-208
>                 URL: https://issues.apache.org/jira/browse/AVRO-208
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>
> the java specific compiler flags ambiguous unions but not enums
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},

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