[
https://issues.apache.org/jira/browse/DERBY-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679825#action_12679825
]
dagw edited comment on DERBY-4071 at 3/7/09 11:25 AM:
---------------------------------------------------------------
I find I can reproduce with this simpler query:
"SELECT * FROM DEMO.TEST S " +
"WHERE CHR IN ( " +
" SELECT MAX(CHR) " +
" FROM DEMO.TEST T " +
" WHERE S.VCHR = T.VCHR " +
" GROUP BY T.VCHR " +
" HAVING COUNT(T.VCHR) > 1 )"
I notice similarities with the erroneous mapArray index in DERBY-3880.
The ProjectRestrictResultSet under the GroupedAggregateResultSet
shares the result colum of the ##aggregate expression for COUNT
with the GroupedAggregateResultSet: That RC contains a VirtualColumnNode
which contains a column reference to the ##UnaggColumn (T.VCHR). When the
mapArray is contructed it picks of the virtual column id of the ##UnaggColumn
(1), which
is wrong, since T.VCHR is column 2 in the underlying table.
I upload a hack, trialPatch.diff, which makes the above sample work, to
illustrate the issue.
Not a solution, of course :)
The repro's method testAssertFailure doesn't crash now, although the
result assert fails: I do not get an empty result set, just looking
quickly at the data I think the query should return a row.
The repro's test method testParsesButFails now fails with another error
(ClassCastException).
was (Author: dagw):
I find I can reproduce with this simpler query:
"SELECT * FROM DEMO.TEST S " +
"WHERE CHR IN ( " +
" SELECT MAX(CHR) " +
" FROM DEMO.TEST T " +
" WHERE S.VCHR = T.VCHR " +
" GROUP BY T.VCHR " +
" HAVING COUNT(T.VCHR) > 1 )"
I notice similarities with the erroneous mapArray index in DERBY-3880.
The ProjectRestrictResultSet under the GroupedAggregateResultSet
shares the result colum of the ##aggregate expression for COUNT
with the GroupedAggregateResultSet: That RC contains a VirtualColumnNode
which contains a column reference to the ##UnaggColumn (T.VCHR). When the
mapArray is contructed it picks of the cirtual column id of the ##UnaggColumn
(1), which
is wrong, since T.VCHR is column 2 in the underlying table.
I upload a hack, trialPatch.diff, which makes the above sample work, to
illustrate the issue.
Not a solution, of course :)
The repro's method testAssertFailure doesn't crash now, although the assert, I
do not get an empty
result set, just looking quickly at the data I think the query should return a
row.
The repro's test method testParsesButFails now fails with another error
(ClassCastException).
> AssertFailure when selecting rows from a table with CHARACTER and VARCHAR
> columns
> ---------------------------------------------------------------------------------
>
> Key: DERBY-4071
> URL: https://issues.apache.org/jira/browse/DERBY-4071
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.2.0
> Reporter: Aaron Digulla
> Attachments: DerbyTest.java, trialPatch.diff
>
>
> When running a complex query on this table:
> [code]
> Create table DEMO.TEST (
> CHR CHARACTER(26) ,
> VCHR VARCHAR(25) )
> [code]
> then I get this exception:
> AssertFailure: ASSERT FAILED col1.getClass() (class ...SQLChar) expected to
> be the same as col2.getClass() (class ....SQLVarchar)' was thrown while
> evaluating an expression.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.