You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/12/01 11:49:20 UTC

[jira] Commented: (DERBY-4457) 'Column value mismatch' in 'testDistinctInsertWithGeneratedColumn(...lang.DistinctTest)' on Jvm 1.5, 1.4, phoneME.

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

Knut Anders Hatlen commented on DERBY-4457:
-------------------------------------------

This failure was introduced by DERBY-4442, and the root cause is that the test relies on a specific implicit ordering of the results that's not guaranteed.

In short, the following sequence of statements (simplified test case)

create table source (x int);
insert into source values 1,2;
create table dest (x int, y int generated always as identity);
insert into dest(x) select distinct x from source;

used to result in the table DEST containing the rows (1,1) and (2,2) regardless of JVM.

After DERBY-4442, it contains (1,1), (2,2) with Sun's JVM version 1.6 or later, whereas earlier JVM versions produce a table that contains the rows (2,1) and (1,2).

Even without the DERBY-4442 patch, one will see that "SELECT DISTINCT X FROM SOURCE" gives different results on different JVMs. But before DERBY-4442, a SELECT DISTINCT that acted as a source for an INSERT statement would go through a sort if the target table contained an identity column, so the rows would happen to be inserted in sorted order. After DERBY-4442, a sort is no longer needed, and the rows are inserted in the same order by which they returned from the DistinctScanResultSet.

Since the insertion order is not guaranteed unless there's an ORDER BY clause (which is not accepted syntax until DERBY-4 is fixed), the difference in the results depending on JVM is OK, and the test should be changed to be independent of the JVM's hash implementation.

> 'Column value mismatch' in 'testDistinctInsertWithGeneratedColumn(...lang.DistinctTest)' on Jvm 1.5, 1.4, phoneME.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4457
>                 URL: https://issues.apache.org/jira/browse/DERBY-4457
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.6.0.0
>         Environment: JVM:
> Sun Microsystems Inc.
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Server VM (build 1.5.0_14-b03 mixed mode 32-bit)
> Sun Microsystems Inc.
> java version "1.4.2_02"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_02-b03 mixed mode 32-bit)
> Product: phoneME Advanced (phoneme_advanced_mr2-b116)
> Profile: Foundation Profile Specification 1.1
> JVM:     CVM phoneme_advanced_mr2-b116 (interpreter loop)
>            Reporter: Ole Solberg
>            Assignee: Knut Anders Hatlen
>
> See e.g. http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.5/testing/testlog/sol/885498-suitesAll_diff.txt :
> 1) testDistinctInsertWithGeneratedColumn(org.apache.derbyTesting.functionTests.tests.lang.DistinctTest)junit.framework.AssertionFailedError: Column value mismatch @ column 'C12', row 1:
>     Expected: >1<
>     Found:    >2<
> 	at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1081)
> 	at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:993)
> 	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:881)
> 	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:819)
> 	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:777)
> 	at org.apache.derbyTesting.functionTests.tests.lang.DistinctTest.testDistinctInsertWithGeneratedColumn(DistinctTest.java:462)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109)
> 	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)

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