dynamobi/dynamobi — Issue #674: [FRG-198] Farrago returns inconsistent results depending on whether or not a column is indexed
Author: dynamobi-build
Created: 2011-12-30 03:42:36+00:00
State: open
Labels: FRG, Runtime

[reporter="zfong", created="Sat, 9 Sep 2006 21:19:46 -0500 (GMT-05:00)"]
This following illustrates the problem:

create table tt(a char(5) primary key, b char(5));

insert into tt values('t1a1', 't1a1');

insert into tt values('t2a2', 't2a2');

select * from tt where a > 't1a1'

returns:

+--------+---------+

| A | B |

+--------+---------+

| t1a1 | t1a1 |

| t2a2 | t2a2 |

+--------+---------+

which is wrong. But the following returns the correct result:

select * from tt where b > 't1a1';

+--------+--------+

| A | B |

+--------+--------+

| t2a2 | t2a2 |

+--------+--------+

I found this while testing the ReshapeExecStream. It has the same problem, and I suspect the reason is the same, since it's using very similar logic as the btree index search. The value tuple that's set up in Farrago and then passed to Fennel for the literal comparisons is not blank padded out to 5 characters in this case. Therefore, when compareTuples() is called on 't1a1 ' vs 't1a1', the result is greater than and therefore, the first row is returned when it shouldn't be.

Residuals will probably have the same problem. So, at least we're all consistently wrong :-).