|
A B made changes - 26/Oct/06 10:31 PM
Yip Ng made changes - 27/Oct/06 07:02 AM
Yip Ng made changes - 27/Oct/06 07:14 AM
Yip Ng made changes - 27/Oct/06 07:14 AM
Thanks for the patch, Yip! It looks good to me. The code change is clear and
well-commented. The new test cases fail without the code change, and they pass once the code change is applied. Your explanation of the problem makes sense. I intend to commit this patch tomorrow. If anybody else is reviewing it, please let us know. Hi Yip, I was just wondering: I see that TernaryOperatorNode is used for a few
other cases, besides just SUBSTR: TRIM, LOCATE, LIKE, TIMESTAMPADD, and TIMESTAMPDIFF all seem to be TernaryOperatorNodes. How does your patch affect the behavior of these functions? I suppose that if it had any affect at all, it would be to prevent similar NPE bugs when one of these functions was used in an way which provoked an isEquivalent() call for a case where the RHS of the Ternary was NULL. I think the patch is fine, I'm just wondering whether it fixes any more problems than just the SUBSTR-in-a-GROUP-BY case that is noted in the description.
Committed derby2008-trunk-diff01.txt to subversion as revision 468696.
Bryan Pendleton made changes - 28/Oct/06 04:15 PM
Thanks Bryan for the review. I am trying out other functions/expression with group by currently to see if other problems arise. I found another problem with NULLIF and I have filed a jira issue(
Yip Ng made changes - 29/Oct/06 09:15 AM
Hi Bryan, besides the SUBSTR function, the patch also fixes NPE for the trim functions (LTRIM, RTRIM).
In 10.2: ij> create table t1 (c1 char(10)); 0 rows inserted/updated/deleted ij> insert into t1 values '123', 'abc'; 2 rows inserted/updated/deleted ij> select rtrim(c1) from t1 group by rtrim(c1); ERROR XJ001: Java exception: ': java.lang.NullPointerException'. ... ij> select ltrim(c1) from t1 group by ltrim(c1); ERROR XJ001: Java exception: ': java.lang.NullPointerException'. From what I see from the sqlgrammar.jj file, the other functions seem to have the third argument filled with a non-null value when its node is constructed, so the NPE won't occur in those cases. I'll add the trim functions testcases in
Yip Ng made changes - 29/Oct/06 10:13 PM
Interesting. This executed successfully due to the fact that the third parameter's is supplied with a value of 1 implicitly if the argument is not specified.
ij> create table t1 (c1 varchar(10)); 0 rows inserted/updated/deleted ij> insert into t1 values 'abc', '123'; 2 rows inserted/updated/deleted ij> select locate(c1, 'abc') from t1 group by locate(c1, 'abc', 1); 1 ----------- 0 1 2 rows selected
Ported to 10.2 branch at subversion revision 480219.
Rick Hillegas made changes - 28/Nov/06 09:42 PM
A B made changes - 21/Feb/07 06:57 PM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DERBY-2008. For SUBSTR function, there can be 2 or 3 arguments, and in the case of 2-args, the rightOperand of the TernaryOperatorNode will be null. In its isEquivalent() method, it did not take care of this case; thus, the NPE. derbyall + junit suite pass.