[ 
https://issues.apache.org/jira/browse/DERBY-3310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571003#action_12571003
 ] 

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

Perhaps this modified repro better illustrates that the sort should
use SQLInteger and not SQLLongint in the original repro:

ij> create table d3310 (x bigint);
0 rows inserted/updated/deleted
ij> insert into d3310 select distinct * from (values 2.0, 2.1, 2.2) v;
ERROR XJ001: Java exception: 'ASSERT FAILED col1.getClass() (class 
org.apache.derby.iapi.types.SQLDecimal) expected to be the same as 
col2.getClass() (class org.apache.derby.iapi.types.SQLLongint): 
org.apache.derby.shared.common.sanity.AssertFailure'.

If the cast to BIGINT happened in or before the sort, the above insert
statement might end up inserting a single row instead of three rows,
since the values would no longer be distinct.

> ASSERT in MergeSort.checkColumnTypes() disallow legal type conversions
> ----------------------------------------------------------------------
>
>                 Key: DERBY-3310
>                 URL: https://issues.apache.org/jira/browse/DERBY-3310
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.0.0
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>         Attachments: cast-repro.sql
>
>
> The following code 
> CREATE TABLE U (SNAME VARCHAR(32000), TNAME VARCHAR(32000), C1 BIGINT);
> -- This triggers an ASSERT (because 2 is INTEGER and not BIGINT)
> INSERT INTO U(SNAME, TNAME, C1) SELECT DISTINCT SCHEMANAME, TABLENAME, 2
>  FROM SYS.SYSTABLES T JOIN SYS.SYSSCHEMAS S ON T.SCHEMAID = S.SCHEMAID;
> gives
> ERROR XJ001: Java exception: 'ASSERT FAILED col1.getClass() (class 
> org.apache.derby.iapi.types.SQLInteger) expected to be the same as 
> col2.getClass() (class org.apache.derby.iapi.types.SQLLongint): 
> org.apache.derby.shared.common.sanity.AssertFailure'.

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

Reply via email to