db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6025) Wrong results with IN lists and indexes in territory based collation
Date Sat, 01 Mar 2014 08:41:19 GMT

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

Mamta A. Satoor updated DERBY-6025:
-----------------------------------

    Attachment: DERBY6025_diff_patch1.txt

Attaching a patch for review(this patch has no junit test. I will add junit test on Monday
and provide another patch but wanted to send out the code change patch today). 

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. Please let
me know if there is any feedback on the patch. I am working on writing junit tests for this
patch next. Thanks
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)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:118)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:440)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:457)
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)
	at org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest.test_5391(SysDiagVTIMappingTest.java:922)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:118)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:440)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:457)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
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)
	at org.apache.derbyTesting.functionTests.tests.lang.SysDiagVTIMappingTest.test_5391(SysDiagVTIMappingTest.java:922)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:118)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:440)
	at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:457)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)

FAILURES!!!
Tests run: 18331,  Failures: 3,  Errors: 0


> 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
>
>
> 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.1.5#6160)

Mime
View raw message