[ https://issues.apache.org/jira/browse/DERBY-3310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571557#action_12571557 ]
Daniel John Debrunner commented on DERBY-3310: ---------------------------------------------- Nice find. To me the whole method seems very strange, why does the type of the source node need to be changed? I wonder if the whole method should be removed, as you say a CAST node might be better. Changing the type of the source node could be a potential for a huge source of bugs, if the implementation of the node is expecting its type to match its contents. Of course the existing comment in the javadoc for the method is one of those useless comments: >>> This is useful when adding a NormalizeResultSetNode. The missing part is *why* is it useful. An example of why I try to request good comments during code reviews, why is the most important part of any comment. > 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 > Assignee: Kathey Marsden > Priority: Minor > Attachments: cast-repro.sql, derby-3310_try1_diff.txt > > > 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.