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

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

Hi Kathey,

Beware, you're getting a WAG here. :) But my opinion is that
SQLInteger is the correct datatype, and SQLLongInt is incorrect.

I'm guessing that the overall query tree looks something like:
 - InsertNode
    - NormalizeResultSetNode
       - SelectNode / ProjectRestrictNode

It seems to me that the data being sorted is the SELECT data,
and that data uses the constant 2, and so that data should have
been sorted as simple integers.

Then, the NormalizeResultSetNode should have generated
a CAST operation to convert the integer to a biginit when the
data is retrieved from the sorter.

And, the VirtualColumnNodes used by the InsertNode should
have pointed to the values returned by the NormalizeResultSetNode,
so it seems correct that the VCN instance that the InsertNode
references should be working with a SQLLongInt.

So I'd suggest investigating the NormalizeResultSetNode, and
whether it is generating the proper buffering CAST operations.


> 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