You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Maryann Xue (JIRA)" <ji...@apache.org> on 2014/03/06 00:08:46 UTC

[jira] [Comment Edited] (PHOENIX-62) Precision loss for decimal type (no scale specified) when creation of index happens after the record insertion

    [ https://issues.apache.org/jira/browse/PHOENIX-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13921581#comment-13921581 ] 

Maryann Xue edited comment on PHOENIX-62 at 3/5/14 11:07 PM:
-------------------------------------------------------------

Not clear what you mean by "DataType API"? but there is a unit test available now: MutableIndexTest.testIndexWithDecimalCol()

And to summarize the phenomenon:
Only when the field is defined as decimal WITHOUT scale, and the index is created after the record upsert, the precision problem happens, like 15.96 becomes 15. Otherwise, either if decimal type is specified with scale, or if record upsert happens after the index creation, the problem does not exist.
Even with the failed test case as listed above, there is only problem with the existing records before index creation and any records inserted after index creation are good.


was (Author: maryannxue):
Not clear what you mean by "DataType API"? but there is a unit test available now: MutableIndexTest.testIndexWithDecimalCol()

And to summarize the phenomenon:
Only when the field is defined as decimal WITHOUT scale, and the index is created after the record upsert, the precision problem happens, like 15.96 becomes 15. Otherwise, either is decimal type is specified with scale, or record upsert happens after the index creation, the problem does not exist.
Even with the failed test case as listed above, there is only problem with the existing records before index creation and any records inserted after index creation are good.

> Precision loss for decimal type (no scale specified) when creation of index happens after the record insertion
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-62
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-62
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 2.2.3
>            Reporter: Maryann Xue
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Sql script:
> CREATE TABLE IF NOT EXISTS "Items"
> ("ItemID" VARCHAR(10) NOT NULL PRIMARY KEY,
>  "ItemName" VARCHAR(50),
>  "Price" DECIMAL)
> IMMUTABLE_ROWS=true;
> UPSERT INTO "Items" ("ItemID", "ItemName", "Price")
> VALUES ('I001', 'BX016', 15.96);
> CREATE INDEX IF NOT EXISTS "iItems" ON "Items"
> ("ItemName")
> INCLUDE
> ("Price");
> SELECT "ItemName", "Price" FROM "Items";
> Output:
> ItemName        Price 
> ---------- ---------- 
> BX016              15 
> But if we put "CREATE INDEX ..." in front of "UPSERT INTO ...", the result comes out right as:
> ItemName        Price 
> ---------- ---------- 
> BX016              15.96 



--
This message was sent by Atlassian JIRA
(v6.2#6252)