You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Christian d'Heureuse (JIRA)" <ji...@apache.org> on 2006/10/29 15:58:16 UTC

[jira] Created: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
--------------------------------------------------------------------

                 Key: DERBY-2016
                 URL: http://issues.apache.org/jira/browse/DERBY-2016
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.2.1.6
         Environment: 1.5.0_06-b05
            Reporter: Christian d'Heureuse


The following statements produce an ArrayIndexOutOfBoundsException:

CREATE TABLE t1 (
   f1 INTEGER);

SELECT COALESCE(MAX(f1),0) FROM t1;

Workaround:
   VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);

Stack trace:
----------------------------------------------------------------
2006-10-29 14:52:53.765 GMT:
 Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
on database directory C:\temp_sys\temp_Derby_TestErr_db

Database Class Loader started - derby.database.classpath=''
2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
java.lang.ArrayIndexOutOfBoundsException: -1
        at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
        at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
        at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik closed DERBY-2016.
--------------------------------


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>             Fix For: 10.3.2.1, 10.4.1.3
>
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543557 ] 

Dag H. Wanvik commented on DERBY-2016:
--------------------------------------

All regression tests passed.

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Attachment: DERBY-2016.stat
                DERBY-2016.diff

This is a patch which makes the repro work. It is for review only at
this point.

Manish's analysis seems correct to me, and my patch builds on that
observation; I simply let the visitor visit firstNonParameterNode also
(which holds the aggregate function). 

Btw, the dumping of the query tree omits to show
firstNonParameterNode, but I added it temporarily and was able to see
that the rewriting had happened after optimization.

I also added a new test to CoalesceTest. 

Running regression tests now.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>         Attachments: DERBY-2016.diff, DERBY-2016.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544142 ] 

Dag H. Wanvik commented on DERBY-2016:
--------------------------------------

You may be correct that this will be equivalent. I will investigate; it would
simplify things a bit. That would yield only one copy (since the one in argumentlist is replaced)
so I was vary of changing the semantics; the generateExpression call would then 
operate on an object still in argumentList, rather than on another tree, but that may be ok.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Attachment: DERBY-2016c.stat
                DERBY-2016c.diff

Preliminary testing indicates that the index approach works also.
So firstNonParameterNode was likely only ever meant to be an alias, but
unfortunately turned out not to be so in this issue ;)

Uploading patch DERBY-2016c. Running regression tests.



> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Fix Version/s: 10.3.1.5

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>             Fix For: 10.3.1.5, 10.4.0.0
>
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Attachment: DERBY-2016d.stat
                DERBY-2016d.diff

All good ideas, thanks! Uploading DERBY-2016d.
This patch also adds another test case to CoalesceTest
using two aggregates in a three argument coalesce. 


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543883 ] 

Knut Anders Hatlen commented on DERBY-2016:
-------------------------------------------

Don't you call accept() twice on firstNonParameterNode now? I don't think the node is ever removed from argumentsList, so you only need to update the reference, I think. Perhaps it would be better to remove the firstNonParameterNode field and instead just store its index?

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik resolved DERBY-2016.
----------------------------------

    Resolution: Fixed
    Derby Info:   (was: [Patch Available])

All tests passed, committed DERBY-2016d as svn 597278.
Resolving. 
Will merge to 10.3 in a day or two.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-2016?page=all ]

Julius Stroffek reassigned DERBY-2016:
--------------------------------------

    Assignee: Julius Stroffek

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: http://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>         Assigned To: Julius Stroffek
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julius Stroffek updated DERBY-2016:
-----------------------------------

    Assignee:     (was: Julius Stroffek)

I moved my attention away and wanted to return back after some time. I am unassigning the issue from myself to leave it for others who  may want to work on that.

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-2016?page=comments#action_12452440 ] 
            
Julius Stroffek commented on DERBY-2016:
----------------------------------------

When I ran this example using 'insane' I go this error:

ERROR XJ001: Java exception: 'ASSERT FAILED generateExpression() should never be called on an AggregateNode.  replaceAggregatesWithColumnReferences should have been called prior to generateExpression: org.apache.derby.shared.common.sanity.AssertFailure'.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: http://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>         Assigned To: Julius Stroffek
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545299 ] 

Dag H. Wanvik commented on DERBY-2016:
--------------------------------------

Merged DERBY-2016d to 10.3 as svn 598054. 


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>             Fix For: 10.3.1.5, 10.4.0.0
>
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Fix Version/s: 10.4.0.0

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>             Fix For: 10.4.0.0
>
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat, DERBY-2016d.diff, DERBY-2016d.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534916 ] 

Kathey Marsden commented on DERBY-2016:
---------------------------------------

Julius, are you actively working on this issue? Please unassign yourself if you are not.

Thanks

Kathey

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Julius Stroffek
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Manish Khettry (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-2016?page=comments#action_12452589 ] 
            
Manish Khettry commented on DERBY-2016:
---------------------------------------

The visit method is used to traverse the parse tree and in this case, replace aggregates with ColumnReferences. See ReplaceAggregatesWIthCRVisitior. CoalesceFunctionNode does seem to have a visit method but there is also a cached ValueNode in this class (firstNonParameterNode) which is not visited which causes this assert failure.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: http://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>         Assigned To: Julius Stroffek
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

    Attachment: DERBY-2016b.stat
                DERBY-2016b.diff

DERBY-2016b supercedes the first patch. I decided to let the code for dumping 
firstNonParameterNode permanent.


> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544423 ] 

Knut Anders Hatlen commented on DERBY-2016:
-------------------------------------------

Patch c looks good! Nits: Couldn't firstNonParameterNodeIdx be private? And perhaps you could add /** ... */ around the fine comment you wrote so that it turns up in the generated javadoc.

By the way, would it be better to initialize firstNonParameterNodeIdx with an invalid index value (like -1) instead of 0? Not a big deal, since it must be an internal bug if we don't find a non-parameter node in the list. But the old code would cause a NullPointerException if it was not found, whereas the new code will silently ignore it. (Ideally, I guess we should have had a findFirstNonParameterNode() method in ValueNodeList instead of storing it in a field. It's only used once anyway, isn't it?)

Regardless of what you choose to do with the above comments, I'm +1 to committing patch c, as it's definitely an improvement.

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat, DERBY-2016b.diff, DERBY-2016b.stat, DERBY-2016c.diff, DERBY-2016c.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-2016:
---------------------------------

           Derby Info: [Patch Available]
    Affects Version/s: 10.2.2.0
                       10.3.1.4

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-2016) ArrayIndexOutOfBoundsException for COALESCE with aggregate functions

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik reassigned DERBY-2016:
------------------------------------

    Assignee: Dag H. Wanvik

> ArrayIndexOutOfBoundsException for COALESCE with aggregate functions
> --------------------------------------------------------------------
>
>                 Key: DERBY-2016
>                 URL: https://issues.apache.org/jira/browse/DERBY-2016
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: 1.5.0_06-b05
>            Reporter: Christian d'Heureuse
>            Assignee: Dag H. Wanvik
>         Attachments: DERBY-2016.diff, DERBY-2016.stat
>
>
> The following statements produce an ArrayIndexOutOfBoundsException:
> CREATE TABLE t1 (
>    f1 INTEGER);
> SELECT COALESCE(MAX(f1),0) FROM t1;
> Workaround:
>    VALUES COALESCE( (SELECT MAX(f1) FROM t1), 0);
> Stack trace:
> ----------------------------------------------------------------
> 2006-10-29 14:52:53.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-948f-0faa-00000012f418
> on database directory C:\temp_sys\temp_Derby_TestErr_db
> Database Class Loader started - derby.database.classpath=''
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
> 2006-10-29 14:53:02.906 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: SELECT COALESCE(MAX(f1),0) FROM t1
> java.lang.ArrayIndexOutOfBoundsException: -1
>         at org.apache.derby.impl.services.bytecode.BCMethod.popStack(Unknown Source)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>         at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>         at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.