You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Scott Carey (JIRA)" <ji...@apache.org> on 2010/12/02 18:39:10 UTC

[jira] Created: (AVRO-706) Java: Type promotion not succeeding for long -> float

Java: Type promotion not succeeding for long -> float
-----------------------------------------------------

                 Key: AVRO-706
                 URL: https://issues.apache.org/jira/browse/AVRO-706
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.4.1
            Reporter: Scott Carey
             Fix For: 1.5.0


A bug reported on the dev email list.  I have not confirmed it:

{quote}
Hi,

Avro spec says that writer schema's long can be promoted to reader
schema's float or double.  In my test, I'm getting ErrorAction from
ResolvingGrammarGenerator.generate() when writer schema is long and
reader schema expects float.  Looking at the source code, when reader
and writer type are not the same, the switch(readerType) only handles
Long, Double and Union, not Float. This is the reason I'm getting "Found
Long, expecting Float" error.

Best regards,

Xiaolu
{quote}

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


[jira] Updated: (AVRO-706) Java: Type promotion not succeeding for long -> float

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

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

    Assignee: Thiruvalluvan M. G.
      Status: Patch Available  (was: Open)

Thanks Xiaolu for pointing this out and Scott for creating Jira.


> Java: Type promotion not succeeding for long -> float
> -----------------------------------------------------
>
>                 Key: AVRO-706
>                 URL: https://issues.apache.org/jira/browse/AVRO-706
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.4.1
>            Reporter: Scott Carey
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.5.0
>
>
> A bug reported on the dev email list.  I have not confirmed it:
> {quote}
> Hi,
> Avro spec says that writer schema's long can be promoted to reader
> schema's float or double.  In my test, I'm getting ErrorAction from
> ResolvingGrammarGenerator.generate() when writer schema is long and
> reader schema expects float.  Looking at the source code, when reader
> and writer type are not the same, the switch(readerType) only handles
> Long, Double and Union, not Float. This is the reason I'm getting "Found
> Long, expecting Float" error.
> Best regards,
> Xiaolu
> {quote}

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


[jira] Updated: (AVRO-706) Java: Type promotion not succeeding for long -> float

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

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

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Committed revision 1041903.

Thanks Doug for reviewing the fix.

> Java: Type promotion not succeeding for long -> float
> -----------------------------------------------------
>
>                 Key: AVRO-706
>                 URL: https://issues.apache.org/jira/browse/AVRO-706
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.4.1
>            Reporter: Scott Carey
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.5.0
>
>         Attachments: AVRO-706.patch
>
>
> A bug reported on the dev email list.  I have not confirmed it:
> {quote}
> Hi,
> Avro spec says that writer schema's long can be promoted to reader
> schema's float or double.  In my test, I'm getting ErrorAction from
> ResolvingGrammarGenerator.generate() when writer schema is long and
> reader schema expects float.  Looking at the source code, when reader
> and writer type are not the same, the switch(readerType) only handles
> Long, Double and Union, not Float. This is the reason I'm getting "Found
> Long, expecting Float" error.
> Best regards,
> Xiaolu
> {quote}

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


[jira] Updated: (AVRO-706) Java: Type promotion not succeeding for long -> float

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

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

    Attachment: AVRO-706.patch

There were two bugs:

1. int and long were not getting promoted to float
2. double was getting "promoted" to long, which is not in the spec.

The attached patch fixes both the bugs. There were already tests for (1) but were commented (I can't remember why). I un-commented them. There was a test verify the wrong behavior (2). I removed it after ensuring that it indeed fails after the patch.

> Java: Type promotion not succeeding for long -> float
> -----------------------------------------------------
>
>                 Key: AVRO-706
>                 URL: https://issues.apache.org/jira/browse/AVRO-706
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.4.1
>            Reporter: Scott Carey
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.5.0
>
>         Attachments: AVRO-706.patch
>
>
> A bug reported on the dev email list.  I have not confirmed it:
> {quote}
> Hi,
> Avro spec says that writer schema's long can be promoted to reader
> schema's float or double.  In my test, I'm getting ErrorAction from
> ResolvingGrammarGenerator.generate() when writer schema is long and
> reader schema expects float.  Looking at the source code, when reader
> and writer type are not the same, the switch(readerType) only handles
> Long, Double and Union, not Float. This is the reason I'm getting "Found
> Long, expecting Float" error.
> Best regards,
> Xiaolu
> {quote}

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


[jira] Commented: (AVRO-706) Java: Type promotion not succeeding for long -> float

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

Doug Cutting commented on AVRO-706:
-----------------------------------

+1 Looks good and tests pass after applying the patch.  Thanks for the quick fix, Thiru!

> Java: Type promotion not succeeding for long -> float
> -----------------------------------------------------
>
>                 Key: AVRO-706
>                 URL: https://issues.apache.org/jira/browse/AVRO-706
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.4.1
>            Reporter: Scott Carey
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.5.0
>
>         Attachments: AVRO-706.patch
>
>
> A bug reported on the dev email list.  I have not confirmed it:
> {quote}
> Hi,
> Avro spec says that writer schema's long can be promoted to reader
> schema's float or double.  In my test, I'm getting ErrorAction from
> ResolvingGrammarGenerator.generate() when writer schema is long and
> reader schema expects float.  Looking at the source code, when reader
> and writer type are not the same, the switch(readerType) only handles
> Long, Double and Union, not Float. This is the reason I'm getting "Found
> Long, expecting Float" error.
> Best regards,
> Xiaolu
> {quote}

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