db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2352) Assertion Failure with order by and group by expression
Date Mon, 15 Oct 2007 18:44:51 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534932

Bryan Pendleton commented on DERBY-2352:

Seems like there are 3 alternatives worth pursuing:
1) Turn the SQLVarchar into a SQLChar
2) Turn the SQLChar into a SQLVarchar
3) Teach the sorter that it should tolerate a mixture of SQLVarchar/SQLChar

The first alternative involves modifying SQLChar.substring() so that 
instead of returning a Varchar, it returns a Char. Perhaps the algorithm
could be something like: substring of a Char returns a Char; substring
of a Varchar returns a Varchar.

The second alternative involves modifying the code that generates the
projection and rowAllocator methods so that the code can more accurately
track the datatype of the ResultColumn in the presence of expression such
as substring, and ensure that the proper actual data type (Varchar in this case)
is used when generating the template row in the rowAllocator method. It
looks like TernaryNode.substrBind() makes some attempts to compute the
resulting data type; perhaps this data type computation just isn't making it
properly into the REsultColumn's data type ID.

The third alternative involves figuring out why MergeSort is complaining when
SQLVarchar != SQLChar, and whether MergeSort could be enhanced to
be more tolerant of mismatching types. As a start, I could try removing the
sanity assertion and see what problems occur farther down the road.

I don't immediately see any reason to prefer one of these solutions over any other;
if anybody has any suggestions about which course of action seems best, please
let me know. Otherwise I'll probably try them each and see how much progress I make.

> Assertion Failure with order by and group by expression
> -------------------------------------------------------
>                 Key: DERBY-2352
>                 URL: https://issues.apache.org/jira/browse/DERBY-2352
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:,
>         Environment: Any
>            Reporter: Yip Ng
>            Assignee: Bryan Pendleton
> Assertion failure with order by expression:
> ij> select substr('abc', 1) from t1 order by substr('abc', 1);
> ERROR XJ001: Java exception: 'ASSERT FAILED col1.getClass() (class org.apache.derby.iapi.types.SQLVarchar)
expected to be the same as col2.getClass() (class org.apache.derby.iapi.types.SQLChar): org.apache.derby.shared.common.sanity.AssertFailure'.
> Stacktrace:
> org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col1.getClass() (class
org.apache.derby.iapi.types.SQLVarchar) expected to be the same as col2.getClass() (class
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:149)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:472)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:106)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:318)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:269)
> 	at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(ProjectRestrictResultSet.java:169)
> 	at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(BasicNoPutResultSetImpl.java:260)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:358)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1182)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:585)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:321)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:517)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:370)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:268)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:204)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:170)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:71)

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

View raw message