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

Prafulla T commented on TAJO-182:
---------------------------------

Thanks for you replies.
Let me know if I mis-understood the changes, but I believe following AND would 
not return correct result in some cases.
{noformat}
       case AND: {
-        boolean left = leftExpr.terminate(binCtx.left).asBool();
-        boolean right = rightExpr.terminate(binCtx.right).asBool();
-        return DatumFactory.createBool(left && right);
+        if (lhs.type() == Type.NULL_TYPE || rhs.type() == Type.NULL_TYPE) {
+          return NullDatum.get();
+        }
+        return DatumFactory.createBool(lhs.asBool() && rhs.asBool());
{noformat}

This would return NULL for "false AND NULL" ? But we need it to return false? 
I think we can create similar case for OR as well.

> 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