tajo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jihoon Son (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAJO-414) Fix bug of bit operations in decode() method of DateDatum class
Date Fri, 13 Dec 2013 05:21:08 GMT

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

Jihoon Son commented on TAJO-414:
---------------------------------

+1
Nice work!

> 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)

Mime
View raw message