[jira] [Commented] (PROTON-1160) [Python binding] decimal32 and decimal64 are sent byte reversed

2018-03-20 Thread Kim van der Riet (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16406437#comment-16406437
 ] 

Kim van der Riet commented on PROTON-1160:
--

Proton Python uses the following types as the parent classes for the decimal 
types:
{noformat}
class decimal32(int): ...
class decimal64(long): ...
class decimal128(bytes): ...{noformat}
but there is a disconnect between these types and an actual decimal value to 
send. Using this approach avoids the issue of how to encode a numeric decimal 
value, and leaves the problem to the user who must convert it to an equivalent 
byte sequence of the correct length.

Qpid Interop Test uses hex values and tests that they are successfully sent and 
received, but this does not test any type of encoding or decoding of a decimal.

The AMQP 1.0 spec simply states that these numbers are decimal 32/64/128-bit 
numbers (IEEE 754-2008 decimal32/64/128).

The C++ bindings use the following:
{noformat}
class decimal32 : public byte_array<4> {};
class decimal64 : public byte_array<8> {};
class decimal128 : public byte_array<16> {};{noformat}
but to my knowledge also does not provide encoding from a decimal number to the 
byte array format.

At some point, we need to extend the APIs to provide useful encoding/decoding 
for these types.

> [Python binding] decimal32 and decimal64 are sent byte reversed
> ---
>
> Key: PROTON-1160
> URL: https://issues.apache.org/jira/browse/PROTON-1160
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Reporter: Kim van der Riet
>Assignee: Kim van der Riet
>Priority: Major
>
> When sending {{decimal32}} and {{decimal64}} types to or from the Python 
> binding, the byte order of the numbers are reversed. This does not apply to 
> the {{decimal128}} type.
> It is noteworthy that this bug was exposed by qpid-interop-test when run 
> against the C++ binding.  In C++, these types are all based on a byte array, 
> whereas in the Python binding, {{decimal32}} and {{decimal64}} are derived 
> from Python types {{int}} and {{long}} respectively, while {{decimal128}} is 
> derived from Python type {{bytes}}.
> Decimal32:
> {noformat}
> sent:['0x', '0x40490fdb', '0xc02df854', '0xff7f']
> received:['0x', '0xdb0f4940', '0x54f82dc0', '0x7fff']
> {noformat}
> Decimal64:
> {noformat}
> sent:['0x', '0x400921fb54442eea', '0xc005bf0a8b145fcf', 
> '0xffef']
> received:['0x', '0xea2e4454fb210940', '0xcf5f148b0abf05c0', 
> '0xefff']
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org



[jira] [Commented] (PROTON-1160) [Python binding] decimal32 and decimal64 are sent byte reversed

2018-03-12 Thread Justin Ross (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396422#comment-16396422
 ] 

Justin Ross commented on PROTON-1160:
-

[~kpvdr], as a user of these APIs, how did you interface to the decimal types?  
Are you passing in byte arrays, or was there something higher level?

> [Python binding] decimal32 and decimal64 are sent byte reversed
> ---
>
> Key: PROTON-1160
> URL: https://issues.apache.org/jira/browse/PROTON-1160
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Reporter: Kim van der Riet
>Assignee: Kim van der Riet
>Priority: Major
>
> When sending {{decimal32}} and {{decimal64}} types to or from the Python 
> binding, the byte order of the numbers are reversed. This does not apply to 
> the {{decimal128}} type.
> It is noteworthy that this bug was exposed by qpid-interop-test when run 
> against the C++ binding.  In C++, these types are all based on a byte array, 
> whereas in the Python binding, {{decimal32}} and {{decimal64}} are derived 
> from Python types {{int}} and {{long}} respectively, while {{decimal128}} is 
> derived from Python type {{bytes}}.
> Decimal32:
> {noformat}
> sent:['0x', '0x40490fdb', '0xc02df854', '0xff7f']
> received:['0x', '0xdb0f4940', '0x54f82dc0', '0x7fff']
> {noformat}
> Decimal64:
> {noformat}
> sent:['0x', '0x400921fb54442eea', '0xc005bf0a8b145fcf', 
> '0xffef']
> received:['0x', '0xea2e4454fb210940', '0xcf5f148b0abf05c0', 
> '0xefff']
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org



[jira] [Commented] (PROTON-1160) [Python binding] decimal32 and decimal64 are sent byte reversed

2018-03-12 Thread Andrew Stitcher (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396406#comment-16396406
 ] 

Andrew Stitcher commented on PROTON-1160:
-

I'm not sure that "sent byte reversed" really has any meaning in the context of 
the proton implementation of the decimalxx types: These types are actually 
floating point types. But proton does not implement that floating point 
semantic in any code whatever.

So it is perhaps moot to say that the python binding values are sent byte 
reversed, since it is not defined what values we are actually sending!

For what it is worth I think the Ruby binding would agree with the Python byte 
stream, so perhaps the C++ binding is in the minority here!

> [Python binding] decimal32 and decimal64 are sent byte reversed
> ---
>
> Key: PROTON-1160
> URL: https://issues.apache.org/jira/browse/PROTON-1160
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Reporter: Kim van der Riet
>Assignee: Kim van der Riet
>Priority: Major
>
> When sending {{decimal32}} and {{decimal64}} types to or from the Python 
> binding, the byte order of the numbers are reversed. This does not apply to 
> the {{decimal128}} type.
> It is noteworthy that this bug was exposed by qpid-interop-test when run 
> against the C++ binding.  In C++, these types are all based on a byte array, 
> whereas in the Python binding, {{decimal32}} and {{decimal64}} are derived 
> from Python types {{int}} and {{long}} respectively, while {{decimal128}} is 
> derived from Python type {{bytes}}.
> Decimal32:
> {noformat}
> sent:['0x', '0x40490fdb', '0xc02df854', '0xff7f']
> received:['0x', '0xdb0f4940', '0x54f82dc0', '0x7fff']
> {noformat}
> Decimal64:
> {noformat}
> sent:['0x', '0x400921fb54442eea', '0xc005bf0a8b145fcf', 
> '0xffef']
> received:['0x', '0xea2e4454fb210940', '0xcf5f148b0abf05c0', 
> '0xefff']
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org