[teiid-issues] [JBoss JIRA] (TEIID-2564) Correlated subqueries throws TEIID30328

Steven Hawkins (JIRA) jira-events at lists.jboss.org
Tue Jul 2 10:45:22 EDT 2013


     [ https://issues.jboss.org/browse/TEIID-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Hawkins updated TEIID-2564:
----------------------------------

          Summary: Correlated subqueries throws TEIID30328  (was: Netezza queries returning "TEIID30328 Unable to evaluate A.IntKey: No value was available")
    Fix Version/s: 8.4.1
                   8.5
      Description: 
Non-pushed correlated subqueries that use a correlation variable that is a grouping column where the subquery is turned into a semi join (either through the MJ hint or costing) will fail to find the correlation values.

For example the following against Netezza (which does not support correlated subqueries):

SELECT A.INTKEY, A.STRINGNUM FROM BQT1.SMALLA AS A WHERE CONVERT(LONGNUM,
STRING) = 8 GROUP BY A.INTKEY, A.STRINGNUM HAVING A.STRINGNUM = (SELECT
MAX(B.STRINGNUM) FROM BQT1.SMALLA AS B WHERE A.INTKEY = B.INTKEY

throws "TEIID30328 Unable to evaluate A.IntKey: No value was available"

If the subplan is not converted to a join or the correlated column is not a grouping expression, then there is no issue.

  was:
Netezza queries returning "TEIID30328 Unable to evaluate A.IntKey:
No value was available".  Queries involved all use HAVING.  
The log file is attached.  

A couple example queries are:

SELECT A.INTKEY, A.STRINGNUM FROM BQT1.SMALLA AS A WHERE CONVERT(LONGNUM,
STRING) = 8 GROUP BY A.INTKEY, A.STRINGNUM HAVING A.STRINGNUM = (SELECT
MAX(B.STRINGNUM) FROM BQT1.SMALLA AS B WHERE A.INTKEY = B.INTKEY

SELECT A.INTKEY, A.FLOATNUM FROM BQT1.SMALLA AS A WHERE NOT (A.INTNUM IS
NULL) GROUP BY A.INTKEY, A.FLOATNUM HAVING A.FLOATNUM = (SELECT
MIN(B.FLOATNUM) FROM BQT1.SMALLA AS B WHERE A.INTKEY = B.INTKEY

Analysis from engineering:
The issue is happening when a the subquery is converted to a join (this is happening under to covers based upon the costing of the subquery plan) and the correlated column is a grouping expression.

If the subplan is not converted to a join or the correlated column is not a grouping expression, then there is no issue.


    
> Correlated subqueries throws TEIID30328
> ---------------------------------------
>
>                 Key: TEIID-2564
>                 URL: https://issues.jboss.org/browse/TEIID-2564
>             Project: Teiid
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 8.4
>            Reporter: Warren Gibson
>            Assignee: Steven Hawkins
>             Fix For: 8.4.1, 8.5
>
>         Attachments: server.log
>
>
> Non-pushed correlated subqueries that use a correlation variable that is a grouping column where the subquery is turned into a semi join (either through the MJ hint or costing) will fail to find the correlation values.
> For example the following against Netezza (which does not support correlated subqueries):
> SELECT A.INTKEY, A.STRINGNUM FROM BQT1.SMALLA AS A WHERE CONVERT(LONGNUM,
> STRING) = 8 GROUP BY A.INTKEY, A.STRINGNUM HAVING A.STRINGNUM = (SELECT
> MAX(B.STRINGNUM) FROM BQT1.SMALLA AS B WHERE A.INTKEY = B.INTKEY
> throws "TEIID30328 Unable to evaluate A.IntKey: No value was available"
> If the subplan is not converted to a join or the correlated column is not a grouping expression, then there is no issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list