db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5933) SQL sorting error
Date Mon, 24 Sep 2012 22:30:08 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Dag H. Wanvik updated DERBY-5933:

    Attachment: d5933-pof.diff

Uploading an experimental patch which makes the query work.

I found that the wrong label to the column reference "B1" happened when that expression was
pushed into the left outer join node at this stack position:


The code in ResultColumn#getColumnPosition looks like this:

	public int getColumnPosition()
		if (columnDescriptor!=null)
			return columnDescriptor.getPosition();
			return virtualColumnId;


In this case, there is a columnDescriptor present in the CR (maybe because it is also used
in the join condition?), but that refers the the base table "B", in which "B1" has column
position 1. However we are here trying to push into the LOJ, in which the real position is
5, the value of virtualColumnId. So, the patch just uses virtualColumnId iff we are sitting
on top of a join.

I tried the patch briefly and it worked for the join and predicate pushdown tests, but I am
still very wary of this hack, but I post it now anyway ;-). Running regressions to see what

> SQL sorting error
> -----------------
>                 Key: DERBY-5933
>                 URL: https://issues.apache.org/jira/browse/DERBY-5933
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:,,,,,,,,,
>         Environment: Windows 7 Netbeans JDBC GUI
>            Reporter: Vlasov Igor
>              Labels: derby_triage10_10
>         Attachments: 5933.log, d5933-pof.diff, Helpdesk.zip, repro.sql, right_sorting.png,
> Hello 
> I have a simple database with 100 records.
> I am running a SQL query from Netbeans GUI though JDBC
> This query was generated by Hibernate ORM.
> In certain circumstances the result rowset is not sorting.
> When I use  condition morefld2_.mf_id in (5) the result is unsortable.
> When I use  condition morefld2_.mf_id in (5,0) the result is sorting properly.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message