madlib/madlib — pull request #161 by renyi533 (2012-05-29 09:40:19+00:00)
Title: fix madlib 474

Please see log below. The index of words should be in the range of [1, dict_size]. But some indexes are larger than 25335. This should be the root cause. The null value cannot fully resolve this issue. The macros, such as ARR_HASNULL, may generate wrong result.

I also provided a function named "check_array_null_elem" to accurately check the null element in array.

testdb=# select count(*) from (select unnest(dict) from madlibtestdata.plda_nsf_abs_dict) l;
count
-------
25335
(1 row)

testdb=# select * from (select unnest(contents) as widx from madlibtestdata.plda_nsf_abs_corpus) l where widx > 25335;
widx
-------
27653
26404
27659
29462
28241
29137
29137
25640
25640
25678
25800
25800
30359