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

Bryan Pendleton commented on DERBY-3310:
----------------------------------------

By itself, CAST operations in NormalizeResultSet would not fix
the sort problem you are seeing, I agree. 

My comments are with respect to your earlier question:
> I am really not sure at the time of the sort whether both template and row 
> data 
> should be SQLInteger or SQLLongInt. If someone could explain which and why

I think I am trying to propose a two-part theory:
1) at the time of the sort, both template and row data should be SQLInteger.
2) Since the Insert requires a SQLLongInteger, I think the conversion from
Int to LongInt should occur in NormalizeResultSet, rather than in the sort.

So working on NormalizeResultSet by itself would be only part of the solution,
it still would also be necessary to change things so that the sort doesn't see
the type mismatch.

Does that make more sense?

thanks,

bryan


> 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