db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1430957 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
Date Wed, 09 Jan 2013 16:53:20 GMT
Author: rhillegas
Date: Wed Jan  9 16:53:20 2013
New Revision: 1430957

URL: http://svn.apache.org/viewvc?rev=1430957&view=rev
Log:
DERBY-6036: Add a test case to verify that restrictions are pushed through views even though
projections aren't.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java?rev=1430957&r1=1430956&r2=1430957&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
Wed Jan  9 16:53:20 2013
@@ -1093,6 +1093,84 @@ public class RestrictedVTITest  extends 
         return actualTypeCount;
     }
     
+    /**
+     * Verify that if you wrap a RestrictedVTI in a view, selects
+     * from the view pass the restriction on to the RestrictedVTI.
+     * However, the projection is not passed through to the view so it
+     * is not passed on to the RestrictedVTI, as described on DERBY-6036.
+     * When that issue is addressed, we should adjust this test case.
+     */
+    public void test_12_6036() throws Exception
+    {
+        Connection conn = getConnection();
+
+        goodStatement( conn, "create view v6036 as select * from table( integerList() ) s"
);
+
+        // directly selecting from the vti pushes down both the projection and the restriction
+        assertResults
+            (
+             conn,
+             "select s_nr from table( integerList() ) s where ns_r = 3000",
+             new String[][]
+             {
+                { "2000" }
+             },
+             false
+             );
+        assertResults
+            (
+             conn,
+             "values getLastProjection()",
+             new String[][]
+             {
+                { "[null, S_NR, NS_R, null]" }
+             },
+             false
+             );
+        assertResults
+            (
+             conn,
+             "values getLastRestriction()",
+             new String[][]
+             {
+                { "\"NS_R\" = 3000" }
+             },
+             false
+             );
+
+        // directly selecting from the view only pushes down the restriction
+        assertResults
+            (
+             conn,
+             "select s_nr from v6036 where ns_r = 3000",
+             new String[][]
+             {
+                { "2000" }
+             },
+             false
+             );
+        assertResults
+            (
+             conn,
+             "values getLastProjection()",
+             new String[][]
+             {
+                { "[S_R, S_NR, NS_R, NS_NR]" }
+             },
+             false
+             );
+        assertResults
+            (
+             conn,
+             "values getLastRestriction()",
+             new String[][]
+             {
+                { "\"NS_R\" = 3000" }
+             },
+             false
+             );
+    }
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // SQL ROUTINES



Mime
View raw message