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-182) Correct NULL value handling of primitive operators
Date Mon, 23 Dec 2013 06:29:50 GMT

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

Jihoon Son commented on TAJO-182:
---------------------------------

Although this patch is already committed, I have some suggestions to improve the patch.
* In Inet4Datum.compareTo(), we can sure that two datums are equal when all the bytes are
same. Thus, the code should be changed as follows.
{code}
  public int compareTo(Datum datum) {
    switch (datum.type()) {
    case INET4:
      byte [] bytes = asByteArray();
      byte [] other = datum.asByteArray();
      
      for (int i = 0; i < 4; i++) {
        if (bytes[i] > other[i]) {
          return 1;
        } else if (bytes[i] < other[i]) {
          return -1;
        }
      }
      return 0; // should be placed after the for clause
      ...
  }
{code}
* In TestBoolDatum.testAsBool(), the first line looks to be intended to test the true datum,
but it contains the false. It would be better to change the code as follows.
{code}
Datum trueDatum = DatumFactory.createBool(true); // create a boolean datum with true instead
of false
{code}

> Correct NULL value handling of primitive operators
> --------------------------------------------------
>
>                 Key: TAJO-182
>                 URL: https://issues.apache.org/jira/browse/TAJO-182
>             Project: Tajo
>          Issue Type: Bug
>          Components: planner/optimizer
>            Reporter: Hyunsik Choi
>            Assignee: Hyunsik Choi
>            Priority: Critical
>             Fix For: 0.8-incubating
>
>         Attachments: TAJO-182.patch, TAJO-182_2.patch, TAJO-182_3.patch
>
>
> -If some domain value is compared to Null value, the current implementation will cause
InvalidOperationException. Such cases should result in 'false'.-
> -If some domain value is compared to Null value, the current implementation will cause
either InvalidOperationException or FALSE. Such cases should result in NULL.-
> Many primitive operators including arithmetic and comparison do not consider three valued
logic. This patch corrects this problem. The original issue title was 'Comparison of primitive
values including null value should return NULL.' This issue was expanded for null value handling
of all primitive operators.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message