db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1501643 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java
Date Wed, 10 Jul 2013 04:19:20 GMT
Author: mamta
Date: Wed Jul 10 04:19:19 2013
New Revision: 1501643

URL: http://svn.apache.org/r1501643
Log:
DERBY-6268(Run-time statistics not collected if query contains always false predicate)


Backporting revision 1495943 from trunk to 10.8.


Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1495943

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java?rev=1501643&r1=1501642&r2=1501643&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
Wed Jul 10 04:19:19 2013
@@ -356,9 +356,9 @@ class ProjectRestrictResultSet extends N
 		/* Nothing to do if open was short circuited by false constant expression */
 		if (shortCircuitOpen)
 		{
-			isOpen = false;
 			shortCircuitOpen = false;
 			source.close();
+            super.close();
 			return;
 		}
 

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java?rev=1501643&r1=1501642&r2=1501643&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java
Wed Jul 10 04:19:19 2013
@@ -2498,6 +2498,27 @@ public class XplainStatisticsTest extend
     }
 
     /**
+     * Test that run-time statistics are recorded even if the query has a
+     * predicate that always evaluates to false. Before DERBY-6268, the logic
+     * that saved the statistics would be short-circuited in such queries.
+     */
+    public void testAlwaysEmptyResultSet() throws Exception {
+        // Execute a query with a predicate that is known at compile time to
+        // evaluate to false. The predicate FALSE should do.
+        String sql = "select * from sysibm.sysdummy1 where false -- DERBY-6268";
+        Statement s = createStatement();
+        enableXplainStyle(s);
+        JDBC.assertEmpty(s.executeQuery(sql));
+        disableXplainStyle(s);
+
+        // Now, see if we find the query among the recorded statements.
+        PreparedStatement ps = prepareStatement(
+            "select * from xpltest.sysxplain_statements where stmt_text = ?");
+        ps.setString(1, sql);
+        JDBC.assertDrainResults(ps.executeQuery(), 1);
+    }
+
+    /**
       * A simple test of table with the wrong 'shape'.
       */
     public void testTableNotValid()



Mime
View raw message