Issue Details (XML | Word | Printable)

Key: DERBY-3303
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: A B
Reporter: Donatas Ciuksys
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

ArrayIndexOutOfBoundsException at MergeSort.compare

Created: 08/Jan/08 01:24 PM   Updated: 30/Jun/09 03:55 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.1.4, 10.3.2.1, 10.4.1.3
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works d3303_10_3_merge.patch 2008-02-19 04:41 PM A B 12 kB
Text File Licensed for inclusion in ASF works d3303_v1.patch 2008-02-15 06:42 PM A B 10 kB
Text File Licensed for inclusion in ASF works d3303_v2.patch 2008-02-16 12:24 AM A B 12 kB
Zip Archive Licensed for inclusion in ASF works db.zip 2008-01-08 01:26 PM Donatas Ciuksys 240 kB
File Licensed for inclusion in ASF works ddl.sql 2008-01-08 01:31 PM Donatas Ciuksys 4 kB
Environment:
------------------ Java Information ------------------
Java Version: 1.6.0_03
Java Vendor: Sun Microsystems Inc.
Java home: D:\Programs\Java\jre1.6.0_03
Java classpath: derbytools.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: Donatas
Java user home: C:\Documents and Settings\Donatas
Java user dir: d:\java\derby-10.3.2.1\lib
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[D:\java\derby-10.3.2.1\lib\derbytools.jar] 10.3.2.1 - (599110)
------------------------------------------------------
----------------- Locale Information -----------------
------------------------------------------------------
Issue Links:
Reference
 

Urgency: Normal
Bug behavior facts: Regression
Resolution Date: 21/Feb/08 05:46 PM


 Description  « Hide
Derby throws ArrayIndexOutOfBoundsException when I try to execute SQL query shown below.

This is a regression, since Derby 10.2.2.0 executes this query without problems.

Attached are DDL statements to create DB tables, and database itself (with data).

2008-01-08 12:32:34.461 GMT Thread[DRDAConnThread_5,6,derby.daemons] (XID = 1497), (SESSIONID = 0), (DATABASE = InventorizacijaDB), (DRDAID = NF000001.G46A-666250070078662256{1}), Failed Statement is: select MAX(preke0_.BARKODAS) as col_0_0_, MAX(preke0_.PAVADINIMAS) as col_1_0_, MAX(preke0_.KIEKIS) as col_2_0_, SUM(irasas1_.FAKTINIS_KIEKIS) as col_3_0_ from PREKE preke0_, IRASAS irasas1_, IRASU_BLOKAS irasubloka2_ where irasas1_.IRASU_BLOKAS=irasubloka2_.ID and preke0_.UNIKALUS_KODAS=irasas1_.UNIKALUS_KODAS and irasubloka2_.INVENTORIZACIJA=? group by irasas1_.UNIKALUS_KODAS order by abs(SUM(irasas1_.FAKTINIS_KIEKIS)-MAX(preke0_.KIEKIS)) DESC with 1 parameters begin parameter #1: 1 :end parameter
java.lang.ArrayIndexOutOfBoundsException: 5
at org.apache.derby.impl.store.access.sort.MergeSort.compare(Unknown Source)
at org.apache.derby.impl.store.access.sort.SortBuffer.insert(Unknown Source)
at org.apache.derby.impl.store.access.sort.MergeInserter.insert(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.openCore(Unknown Source)
at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown Source)
at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #628823 Mon Feb 18 17:19:06 UTC 2008 abrown DERBY-3303: Fix OrderByColumn.java to account for "pulled" GROUP BY columns
when a) checking to see if the user has specified a valid ORDER BY column,
and b) trying to resolve "pulled" ORDER BY columns to their underlying values.
Also, add some relevant test cases to the existing lang/orderby.sql test.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java

Repository Revision Date User Message
ASF #629535 Wed Feb 20 17:01:05 UTC 2008 abrown DERBY-3303: Fix OrderByColumn.java to account for "pulled" GROUP BY columns
when a) checking to see if the user has specified a valid ORDER BY column,
and b) trying to resolve "pulled" ORDER BY columns to their underlying values.
Also, add some relevant test cases to the existing lang/orderby.sql test.

Port to 10.3 using "d3303_10_3_merge.patch" as attached to the Jira. No
additional changes were necessary.
Files Changed
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java