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

Hyunsik Choi commented on TAJO-182:
-----------------------------------

{quote}
Float4Datum::compareTo should raise exception when NullValue is seen? Just to 
be safe?
I see that we can do this in almost all other classes Int,Text etc.
{quote}

Float4Datum::compareTo is returning -1. Others are also the same. This may be 
caused some inconstant use of brackets. 

{code:title=Float4Datum::compareTo}
  @Override
  public int compareTo(Datum datum) {
    switch (datum.type()) {
      ...      
      ...
      case FLOAT8: {
        double another = datum.asFloat8();
        if (val < another) {
          return -1;
        } else if (val > another) {
          return 1;
        } else {
          return 0;
        }
      }
      case NULL_TYPE:
        return -1;
      default:
        throw new InvalidOperationException();
    }
  }
{code}

{quote}
Type of a > NULL should be Boolean OR NULL ? If NULL, we need to change type 
determination logic?

For NULL with AND /OR, we need to consider three value logic?
https://en.wikipedia.org/wiki/Three-valued_logic
{quote}

Very nice questions! Yes, I've considered three valued logic even for AND and 
OR cases. I'll also add additional unit tests for AND and OR cases. I think we 
don't need to change the type determination logic. Type determination logic is 
only used to determine the expected schema. NULL can be occur from only field 
data.

Also, I'll fix inconsistency of whitespace and tabs. In these days, I'm feeling 
the needs of automatic coding standard verification by using maven checkstyle 
plugin.

Thanks, and have nice holidays.

> Comparison of primitive values including null value should return NULL.
> -----------------------------------------------------------------------
>
>                 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
>
>
> -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.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to