You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tajo.apache.org by "Jihoon Son (JIRA)" <ji...@apache.org> on 2013/12/13 06:42:08 UTC
[jira] [Resolved] (TAJO-414) Fix bug of bit operations in decode()
method of DateDatum class
[ https://issues.apache.org/jira/browse/TAJO-414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jihoon Son resolved TAJO-414.
-----------------------------
Resolution: Fixed
I committed the patch.
Thanks!
> Fix bug of bit operations in decode() method of DateDatum class
> ---------------------------------------------------------------
>
> Key: TAJO-414
> URL: https://issues.apache.org/jira/browse/TAJO-414
> Project: Tajo
> Issue Type: Bug
> Reporter: Keuntae Park
> Assignee: Keuntae Park
> Priority: Trivial
> Attachments: TAJO-414.patch
>
>
> data structure for date is 32 bits and consists of
> |meaning | Year | Month | Day |
> | bit offset | 31-16 | 15-8 | 7 - 0|
> However, current code does not correctly decode the structure as
> {noformat}
> private static LocalDate decode(int val) {
> int year = (val >> 16);
> int monthOfYear = (0x0FFF & val) >> 8;
> int dayOfMonth = (0xF0FF & val);
> return new LocalDate(year, monthOfYear, dayOfMonth);
> }
> {noformat}
> Bit operations should be changed to
> {noformat}
> int monthOfYear = (0xFFFF & val) >> 8;
> int dayOfMonth = (0x00FF & val);
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)