I took a look at the ViewIndex class to see if there was anything
obvious with the array index out of bounds error, and the one thing
that stood out was the reinitialization of the columns array within
the getCost() method.  Should the columns array, first seen in this
method around line 111, be a local variable to the getCost() method,
or is it supposed to be the columns array from the BaseIndex class.
It seems that using the global variable will cause a problem if
multiple calls are made into getCost() method, as well as making the
contents of the columns variable dependent on the last call to getCost
().  I haven't tried to understand exactly what the variable is used
for yet, but just thought I would let you know what I saw during my
first pass over the code.

Thanks
Matt

On Jun 10, 3:32 pm, Matt <[email protected]> wrote:
> I'm not sure if this the same exception that others were getting, and
> was thought to be fixed in 1.1.114, but various members of my group
> have been seeing this exception at various times during use of in
> memory h2 instances.
>
> I cleaned up the exception a bit, since it had a lot of extra product
> stack in it.  I can't provide a good test case at the moment since the
> exception isn't occurring with any pattern.  The TABLE_TMP is a local
> temporary table, the STATEMENTS_VIEW is a view that unions 2 other
> tables and NULLTABLE is a table with one row.
>
> If I can recreate a test case I'll submit that, but we can hope it
> will be something obvious.
>
> Thanks,
> Matt
>
> org.h2.jdbc.JdbcSQLException: General error:
> java.lang.ArrayIndexOutOfBoundsException: 4; SQL statement:
> SELECT DISTINCT
>         tp1.COLUMN3 AS "obj1",
>         tp2.COLUMN3 AS "obj2",
>         tp1.COLUMN1 AS "obj3",
>         tp3.COLUMN3 AS "obj4",
>         NULLTABLE.FAKE AS "fakeVAR"
> FROM
>         TABLE_TMP ds,
>         STATEMENTS_VIEW tp1,
>         STATEMENTS_VIEW tp2,
>         STATEMENTS_VIEW tp3,
>         NULLTABLE
> WHERE
>         tp1.COLUMN2=1152921504606847002 AND
>         tp1.COLUMN4 = ds.ID AND
>         tp2.COLUMN2=1152921504606846998 AND
>         tp2.COLUMN4 = ds.ID AND
>         tp3.COLUMN2=1152921504606847008 AND
>         tp3.COLUMN4 = ds.ID AND
>         tp1.COMMITTED = 0  AND
>         tp2.COMMITTED = 0  AND
>         tp3.COMMITTED = 0  AND
>         tp1.COLUMN3 = ds.ID AND
>         tp1.COLUMN1 = tp2.COLUMN1 AND
>         tp1.COLUMN1 = tp3.COLUMN1 AND
>         tp1.COLUMN1 = 1152921504606849663 AND
>         tp2.COLUMN1 = 1152921504606849663 AND
>         tp3.COLUMN1 = 1152921504606849663
>
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
>     at org.h2.index.ViewIndex.getCost(ViewIndex.java:126)
>     at org.h2.table.TableView.getBestPlanItem(TableView.java:141)
>     at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:141)
>     at org.h2.table.Plan.calculateCost(Plan.java:109)
>     at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:180)
>     at
> org.h2.command.dml.Optimizer.calculateBruteForceAll(Optimizer.java:
> 109)
>     at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:
> 86)
>     at org.h2.command.dml.Optimizer.optimize(Optimizer.java:233)
>     at org.h2.command.dml.Select.preparePlan(Select.java:805)
>     at org.h2.command.dml.Select.prepare(Select.java:738)
>     at org.h2.command.Parser.prepareCommand(Parser.java:235)
>     ... 31 more
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to