[teiid-issues] [JBoss JIRA] (TEIID-5077) Couchbase strange behaviour for long numbers
Jan Stastny (JIRA)
issues at jboss.org
Fri Oct 6 06:01:00 EDT 2017
[ https://issues.jboss.org/browse/TEIID-5077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13473224#comment-13473224 ]
Jan Stastny commented on TEIID-5077:
------------------------------------
[~shawkins] What are the expectations for predefined DDL metadata by user? Should the property override the behaviour also in that case?
When I use DDL metadata:
{code:sql|title=Source}
CREATE FOREIGN TABLE SmallA (
documentID string PRIMARY KEY,
type string OPTIONS (NAMEINSOURCE '`type`'),
IntKey integer OPTIONS (NAMEINSOURCE '`IntKey`'),
FloatNum double OPTIONS (NAMEINSOURCE '`FloatNum`'),
BigIntegerValue biginteger OPTIONS (NAMEINSOURCE '`BigIntegerValue`'),
StringKey string OPTIONS (NAMEINSOURCE '`StringKey`'),
CharValue string OPTIONS (NAMEINSOURCE '`CharValue`'),
LongNum long OPTIONS (NAMEINSOURCE '`LongNum`'),
DoubleNum double OPTIONS (NAMEINSOURCE '`DoubleNum`'),
ObjectValue object OPTIONS (NAMEINSOURCE '`ObjectValue`'),
ShortValue integer OPTIONS (NAMEINSOURCE '`ShortValue`'),
BigDecimalValue bigdecimal OPTIONS (NAMEINSOURCE '`BigDecimalValue`'),
DateValue string OPTIONS (NAMEINSOURCE '`DateValue`'),
BooleanValue boolean OPTIONS (NAMEINSOURCE '`BooleanValue`'),
TimestampValue string OPTIONS (NAMEINSOURCE '`TimestampValue`'),
ByteNum integer OPTIONS (NAMEINSOURCE '`ByteNum`'),
StringNum string OPTIONS (NAMEINSOURCE '`StringNum`'),
TimeValue string OPTIONS (NAMEINSOURCE '`TimeValue`'),
IntNum integer OPTIONS (NAMEINSOURCE '`IntNum`')
) OPTIONS (NAMEINSOURCE '`dvqe_crud`', UPDATABLE TRUE, "teiid_couchbase:ISARRAYTABLE" 'false', "teiid_couchbase:NAMEDTYPEPAIR" '`type`:''nullSmallA''');
{code}
translator override:
{code:xml}
<translator name="couchbase-override" type="couchbase">
<property name="UseDouble" value="true"/>
</translator>
{code}
and perform an INSERT:
{code:sql}
INSERT INTO CRUD.SmallA
(IntKey, StringKey, IntNum, StringNum, FloatNum, LongNum, DoubleNum, ByteNum, DateValue, TimeValue, TimestampValue, BooleanValue, CharValue, ShortValue, BigIntegerValue, BigDecimalValue, ObjectValue)
VALUES
(10, '10', -2185591, null, convert(10816.7, float), 4964473766577711554, convert(1509403.57, double), null, {d '2008-10-14'}, {t '06:40:48'}, null, false, convert('2', char), convert(9885, short), 18812, null, '-162')
{code}
this is what I can see in couchbase by using cbq cli tool:
{code:json}
{
"dvqe_crud": {
"BigDecimalValue": null,
"BigIntegerValue": 18812,
"BooleanValue": false,
"ByteNum": null,
"CharValue": "2",
"DateValue": "2008-10-14",
"DoubleNum": 1509403.57,
"FloatNum": 10816.7001953125,
"IntKey": 10,
"IntNum": -2185591,
"LongNum": 4964473766577711000,
"ObjectValue": "-162",
"ShortValue": 9885,
"StringKey": "10",
"StringNum": null,
"TimeValue": "06:40:48",
"TimestampValue": null,
"type": "nullSmallA"
}
}
{code}
Shouldn't have the property fixed this?
Moreover, when I use WHERE clause on LongNum, then all the 4964473766577711XXX values match each other.
> Couchbase strange behaviour for long numbers
> --------------------------------------------
>
> Key: TEIID-5077
> URL: https://issues.jboss.org/browse/TEIID-5077
> Project: Teiid
> Issue Type: Bug
> Components: Documentation, Misc. Connectors
> Affects Versions: 8.12.x-6.4
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
> Priority: Critical
> Fix For: 10.0, 8.12.x-6.4, 9.3.4
>
>
> There is a strange limitation for storing large numbers (e.g. modelled as long) in Couchbase.
> https://forums.couchbase.com/t/strange-behavior-when-saving-big-long-numbers-3-0-1-ce/4793
> The same behaviour with value: 28341791043587382
> which is being stored and retreived as: 28341791043587384
> I feel we need to document this behaviour and provide hints how to overcome it. (Modelling of the column as string on Couchbase's side and defining a view).
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the teiid-issues
mailing list