You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tajo.apache.org by "Keuntae Park (JIRA)" <ji...@apache.org> on 2013/12/12 07:37:06 UTC
[jira] [Comment Edited] (TAJO-60) Implement Date Datum Type
[ https://issues.apache.org/jira/browse/TAJO-60?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13846098#comment-13846098 ]
Keuntae Park edited comment on TAJO-60 at 12/12/13 6:35 AM:
------------------------------------------------------------
[~hyunsik] I have a question just for curiosity :)
Is there any reason that decode() method has following bit operations ?
{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}
Because I think following code is more literal interpretation of date type (year: 2bytes, month: 1byte, day: 1byte)
{noformat}
int monthOfYear = (0xFFFF & val) >> 8;
int dayOfMonth = (0x00FF & val);
{noformat}
Of course, I know both have the same results as month value should be between 1 and 12, which is smaller than 0xF.
was (Author: sirpkt):
[~hyunsik] I have a question just for curiosity :)
Is there any reason that decode() method has following bit operations ?
{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}
Because I think following code is more literal interpretation of date type (year: 2bytes, month: 1bytes, day: 1bytes)
{noformat}
int monthOfYear = (0xFFFF & val) >> 8;
int dayOfMonth = (0x00FF & val);
{noformat}
Of course, I know both have the same results as month value should be between 1 and 12, which is smaller than 0xF.
> Implement Date Datum Type
> -------------------------
>
> Key: TAJO-60
> URL: https://issues.apache.org/jira/browse/TAJO-60
> Project: Tajo
> Issue Type: Sub-task
> Components: catalog
> Reporter: Hyunsik Choi
> Assignee: Hyunsik Choi
> Fix For: 0.8-incubating
>
> Attachments: TAJO-60.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)