[ https://issues.apache.org/jira/browse/CALCITE-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15007308#comment-15007308 ]
Julian Hyde edited comment on CALCITE-972 at 11/16/15 9:01 PM: --------------------------------------------------------------- Makes sense. Let's agree on the format of the string. Hopefully it can be something simple, e.g. {code}/-?[0-9]+(\.[0-9]+)?/{code}We don't need scientific notation, right? The client should be expecting strings - the column should be declared as using Rep.STRING - and can therefore create a DecimalFromStringAccessor. was (Author: julianhyde): Makes sense. Let's agree on the format of the string. Hopefully it can be something simple, e.g. /-?[0-9]+(\.[0-9]+)?/. We don't need scientific notation, right? The client should be expecting strings - the column should be declared as using Rep.STRING - and can therefore create a DecimalFromStringAccessor. > Decimal data sent by Avatica cannot be interpreted by some clients > ------------------------------------------------------------------ > > Key: CALCITE-972 > URL: https://issues.apache.org/jira/browse/CALCITE-972 > Project: Calcite > Issue Type: Bug > Components: avatica > Affects Versions: 1.5.0 > Reporter: Kevin Liew > Assignee: Julian Hyde > Labels: avatica, calcite, decimal, double, wireprotocol > > JSON specifies a 'number' data type which does not differentiate between > integer and floating-point values. The encoding for JSON numbers is > implementation-specific. Libraries such as RapidJSON can treat all > non-integer values as 'double' while still being compliant with JSON > specifications. As a result, decimal values sent by Phoenix will lose > precision on the client side. > Decimal data should be sent as a string. If it is sent as a number, we cannot > be expect that all JSON-spec compliant library will handle it properly. > ie. Phoenix sends a decimal as a JSON number, but Rapidjson can only extract > JSON numbers as integer or double because the C++ language does not have > native decimal support. -- This message was sent by Atlassian JIRA (v6.3.4#6332)