tajo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keuntae Park (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAJO-414) Fix bug of bit operations in decode() method of DateDatum class
Date Fri, 13 Dec 2013 04:29:10 GMT
Keuntae Park created TAJO-414:
---------------------------------

             Summary: 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


data structure for date is 32 bits and consists of 

{| class="wikitable"
|-
! 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