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

ASF subversion and git services commented on DERBY-6025:
--------------------------------------------------------

Commit 1574565 from [~mamtas] in branch 'code/trunk'
[ https://svn.apache.org/r1574565 ]

DERBY-6025(Wrong results with IN lists and indexes in territory based collation)

Basically, when all the elements in the inlist are not all constants, then we 
can not figure out at compile time the minimum and maximum values in the list. 
Mimimum and maximum values in the in list are required to be passed as start 
and stop keys if compiler decides to use an index for the inlist predicate. 
Since these can not be determined at compile time for non constant elements, 
InListOperatorNoce.generateStartStopKey ends up generating code which will run 
at execution time of the query and at that time, we will compare the values of 
the individual elements in the in list to determine the minimum and maximum 
values. The porblem is that currently, Derby does not pass the collation 
information of the left operand of the inlist to execution time and because of 
that, we end up doing English comparison of the values rather than terriroty 
based comparison in case of territory based database. The fix is to have 
InListOperatorNoce.generateStartStopKey generate code to pass collation 
information also. This way, we will do collation based comparison of in list 
elements in case of territory based database. I have run the reproducible case 
from jira against my changes and the query now returns correct row. I have run 
derbyall against the changes and it finished with no errors. The junit suite is 
running into following 3 failures but I have verified that those 3 failures 
happen without my changes too. So I will assume that these failures are not 
caused by my changes. The failures are copied below.
There were 3 failures:
1) 
testStartNetworkServerLogMessageOnDualStart(org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetAutoStartTest)junit.framework.AssertionFailedError:
 did not find the expected string: An exception was thrown during network 
server startup within the maximum wait time 240000
at 
org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetAutoStartTest.testStartNetworkServerLogMessageOnDualStart(DerbyNetAutoStartTest.java:272)
2) 
test_5391(org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest)junit.framework.AssertionFailedError
at 
org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest.vetTimestamp(SysDiagVTIMappingTest.java:933)
3) 
test_5391(org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest)junit.framework.AssertionFailedError
at 
org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest.vetTimestamp(SysDiagVTIMappingTest.java:933)

> Wrong results with IN lists and indexes in territory based collation
> --------------------------------------------------------------------
>
>                 Key: DERBY-6025
>                 URL: https://issues.apache.org/jira/browse/DERBY-6025
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0, 10.6.1.0, 10.6.2.1, 
> 10.7.1.1, 10.8.1.2, 10.8.2.2, 10.8.3.0, 10.9.1.0, 10.10.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Mamta A. Satoor
>              Labels: derby_triage10_11
>         Attachments: DERBY6025_diff_patch1.txt, DERBY6025_diff_patch2.txt
>
>
> The sequence below shows that a query returns 1 row when there is no index on 
> the table, and it returns 0 rows when an index is created. It should return 1 
> row regardless of the index's presence.
> ij version 10.9
> ij> connect 
> 'jdbc:derby:memory:colldb;create=true;territory=no;collation=TERRITORY_BASED';
> ij> create table t(x varchar(40));
> 0 rows inserted/updated/deleted
> ij> insert into t values 'Stranda Idrottslag', 'Aalesunds Fotballklubb';
> 2 rows inserted/updated/deleted
> ij> select * from t where x in ('Aalesunds Fotballklubb', cast('xyz' as 
> char(3)));
> X                                       
> ----------------------------------------
> Aalesunds Fotballklubb                  
> 1 row selected
> ij> create index i on t(x);
> 0 rows inserted/updated/deleted
> ij> select * from t where x in ('Aalesunds Fotballklubb', cast('xyz' as 
> char(3)));
> X                                       
> ----------------------------------------
> 0 rows selected



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to