public class st_derby1939
extends java.lang.Object
Repro for DERBY-1939. In effect what we have to do is execute
a query (using a PreparedStatement) for which the optimizer
will choose to do a Hash Join using an IndexToBaseRow result
result. But that's not enough--at execution time, we then
have to force a situation where the Hash Table "spills" to
disk, and only then will the error occur.
In order to get the optimizer to choose the necessary plan
we have a moderately complex query that has a predicate
which can be pushed to table T1. T1 in turn has an index
declared on the appropriate column. The optimizer will
then choose to do a Hash Join between T2 and T1 and
will use the index on T1, as desired.
Then, in order to force the "spill" to disk, we use the
Derby property "maxMemoryPerTable" and set it to a
"magic" value that a) is large enough to allow the optimizer
to choose a Hash Join, but b) is small enough to cause
hash-table-spill-over at execution time. It took a while
find out what value this property should have given the
data in the tables, but having found it we can now reliably
reproduce the failure.