Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1741#discussion_r235216010
  
    --- Diff: core/sql/exp/exp_bool.cpp ---
    @@ -96,7 +96,7 @@ ex_expr::exp_return_type ex_branch_clause::eval(char 
*op_data[],
       switch (getOperType())
         {
         case ITM_AND:
    -      if (*(Lng32 *)op_data[1] == 0)
    +      if (*(Lng32 *)op_data[1] == 0 || *(Lng32 *)op_data[1] == -1)  // 
null treated as false
    --- End diff --
    
    I don't believe this is correct. Consider the query, "select a from t1x 
where not(b = 0 and c = 0)". When B and C are both null, both equal predicates 
evaluate to null, and the AND evaluates to null. The NOT then also evaluates to 
null. The WHERE clause should treat the result of the NOT as false. But with 
this fix, the result of the AND will be false, making the NOT true. There needs 
to be three cases here for ITM_AND: If the first operand is false, then the AND 
is false. If the first operand is true, then the result is the second operand. 
If the first operand is null, then if the second operand is false, the result 
is false otherwise the result is null. Similar logic needs to be added to the 
ITM_OR case.


---

Reply via email to