Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.RuntimeStatisticsParser$Qualifier


       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // nested loop exists join, right side should be
        // ProjectRestrict on index scan with start and stop keys
       
      
       //Comparisons between 'REAL' and 'CHAR (UCS_BASIC)' are not supported
        assertStatementError("42818", st,
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2) and c1 in ('5', '7'))");
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // hash exists join, right side PR on hash index scan, no
        // start/stop key, next qualifier "=".
       
        rs = st.executeQuery(
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2))");
       
        expColNames = new String [] {"C1"};
        JDBC.assertColumnNames(rs, expColNames);
       
        expRS = new String [][]
        {
            {"8.0"},
            {"5.0"}
        };
       
        JDBC.assertFullResultSet(rs, expRS, true);
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // hash exists join, right side PR on hash index scan,
        // still no start/stop key, next qualifier "=". It still
        // doesn't have start/stop key because c1 in ('5', '7') is
        // blocked out by 2 others.
       
      
        //Comparisons between 'REAL' and 'CHAR (UCS_BASIC)' are not supported
        assertStatementError("42818", st,
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2) and c1 in ('5', '7'))");
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
       st.executeUpdate(
            " create index i12 on t1 (c1, c2)");
       
        // at push "in" time, we determined that it is key and we
        // can push; but at hash time we determined it's not key. 
        // Now the key is it should be filtered out, otherwise we
        // get exception.
       
        rs = st.executeQuery(
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c2 in (5, t2.c2))");
       
        expColNames = new String [] {"C1"};
        JDBC.assertColumnNames(rs, expColNames);
        JDBC.assertDrainResults(rs, 0);
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // just some more tests in different situations, not for
        // the bug 4316 many items
       
View Full Code Here


                } else if (ps.getUpdateCount() == -1) {
                    // No result set and no update count means no more results
                    break;
                }
            }
            RuntimeStatisticsParser rtsp =
                    SQLUtilities.getRuntimeStatisticsParser(s);
            // Before DERBY-4204 the assert below would fail for some kinds
            // of statements because the statistics for the previous call to
            // SYSCS_GET_RUNTIMESTATISTICS() would be returned instead of the
            // statistics for the previously executed statement.
            assertTrue("Wrong statement", rtsp.findString(sql, 1));
        }
        if (schema != null)
        {
            // Before DERBY-4204, we would only get a single row for some
            // kinds of statements, because the statistics weren't re-captured.
View Full Code Here

        rs = st.executeQuery(
            " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
        rs.next();

        if(usingEmbedded()){
            RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
            rs.close();
            assertTrue(rtsp.usedTableScan());
            assertFalse(rtsp.usedDistinctScan());
        }
       
        st.close();
    }
View Full Code Here

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // nested loop exists join, right side should be
        // ProjectRestrict on index scan with start and stop keys
       
      
       //Comparisons between 'REAL' and 'CHAR (UCS_BASIC)' are not supported
        assertStatementError("42818", st,
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2) and c1 in ('5', '7'))");
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // hash exists join, right side PR on hash index scan, no
        // start/stop key, next qualifier "=".
       
        rs = st.executeQuery(
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2))");
       
        expColNames = new String [] {"C1"};
        JDBC.assertColumnNames(rs, expColNames);
       
        expRS = new String [][]
        {
            {"8.0"},
            {"5.0"}
        };
       
        JDBC.assertFullResultSet(rs, expRS, true);
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // hash exists join, right side PR on hash index scan,
        // still no start/stop key, next qualifier "=". It still
        // doesn't have start/stop key because c1 in ('5', '7') is
        // blocked out by 2 others.
       
      
        //Comparisons between 'REAL' and 'CHAR (UCS_BASIC)' are not supported
        assertStatementError("42818", st,
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c1 in (5, t2.c2) and c1 in ('5', '7'))");
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
       st.executeUpdate(
            " create index i12 on t1 (c1, c2)");
       
        // at push "in" time, we determined that it is key and we
        // can push; but at hash time we determined it's not key. 
        // Now the key is it should be filtered out, otherwise we
        // get exception.
       
        rs = st.executeQuery(
            "select c1 from t2 where c1 in (select c1 from t1 "
            + "where c2 in (5, t2.c2))");
       
        expColNames = new String [] {"C1"};
        JDBC.assertColumnNames(rs, expColNames);
        JDBC.assertDrainResults(rs, 0);
       
        st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        rs=st.executeQuery("SELECT C1 FROM t2");
        while(rs.next()){}
        rs.close();

       rs = st.executeQuery(
           " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
       rs.next();

       if(usingEmbedded()){
           RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
           rs.close();
           assertTrue(rtsp.usedTableScan());
           assertFalse(rtsp.usedDistinctScan());
       }
       
        // just some more tests in different situations, not for
        // the bug 4316 many items
       
View Full Code Here

        "AND table1.id=m1.id AND m1.name='PostComponentId' "+
        "AND m1.value='21857' ORDER BY m0.value";

        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        ResultSet rs = s.executeQuery(sql1);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedTableScan("TABLE2"));
    assertTrue(rtsp.whatSortingRequired());

        rs = s.executeQuery(sql1);
        String[][] result = {
                {"4294967297", "000001", "21857"},
                {"2147483653", "000002", "21857"},
View Full Code Here

        "m1.name='PostComponentId' AND m1.value='21857' " +
        "ORDER BY m0.value";

        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        ResultSet rs = s.executeQuery(sql1);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("TABLE2","KEY3"));
    assertTrue(rtsp.whatSortingRequired());
 
        rs = s.executeQuery(sql1);
        String[][] result = {
                {"4294967297", "000001", "21857"},
                {"2147483653", "000002", "21857"},
View Full Code Here

        "AND table1.id=m1.id AND m1.name='PostComponentId' AND "+
        " m1.value='21857' ORDER BY m0.value";

    s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        ResultSet rs = s.executeQuery(sql1);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(
        s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("TABLE2","KEY3"));
    assertTrue(rtsp.whatSortingRequired());

    rs = s.executeQuery(sql1);
        String[][] result = {
                {"4294967297", "000001", "21857"},
                {"2147483653", "000002", "21857"},
View Full Code Here

     * for both ascending and descending order by clause. 
     */
    public void testDerby4331() throws SQLException {
        Statement s;
        ResultSet rs;
        RuntimeStatisticsParser rtsp;
        String [][] desc_result = new String[][] {
            {"3"},{"3"},{"2"},{"2"},{"2"},{"1"}};
        String [][] asc_result  = new String[][] {
            {"1"},{"2"},{"2"},{"2"},{"3"},{"3"}};
       
View Full Code Here

        String sql1 =
          "SELECT t1.id, t1.name FROM test2 t2 INNER JOIN test1 t1 "+
          "ON t2.rel_id = t1.id WHERE t2.entity_id = 1 ORDER BY t1.id ASC";
        Statement s;
        ResultSet rs;
        RuntimeStatisticsParser rtsp;
        String [][] result;

        s = createStatement();
        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        rs = s.executeQuery(sql1);
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.whatSortingRequired());
        rs = s.executeQuery(sql1);
        result = new String[][] {
                {"101", "Pupy"},{"102", "Tom"}, {"103", "Jerry"}};
        JDBC.assertFullResultSet(rs, result);
    }
View Full Code Here

     */
    public void testAdditionalOrderByCases() throws SQLException {
        String sql1;
        Statement s;
        ResultSet rs;
        RuntimeStatisticsParser rtsp;
        String [][] result;

        s = createStatement();
        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
       
        sql1 = "select a.col1, b.col2, c.col2 from a, b, c where c.col1=3 " +
        "order by a.col1, c.col1";
        rs = s.executeQuery(sql1);
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.whatSortingRequired());
        rs = s.executeQuery(sql1);
        result = new String[][] {
                {"1", "2", "3"},{"1", "2", "3"}, {"1", "2", "3"},  
                {"1", "2", "3"},{"1", "2", "3"}, {"1", "2", "3"},  
                {"1", "2", "3"},{"1", "2", "3"}};
        JDBC.assertFullResultSet(rs, result);
       
        sql1 = "select a.col1, b.col2, c.col2 from a, b, c where a.col1=1 "+
        "and b.col1 = 2 and c.col1=3 order by a.col1, b.col1, c.col1";
        rs = s.executeQuery(sql1);
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertFalse(rtsp.whatSortingRequired());
        rs = s.executeQuery(sql1);
        JDBC.assertFullResultSet(rs, result);

        sql1 = "select c.col1, b.col1, a.col1 from a, b, c where a.col1=1 "+
        "and b.col1 = 2 and c.col1=3 order by c.col1, b.col1, a.col1";
        result = new String[][] {
                {"3", "2", "1"},{"3", "2", "1"}, {"3", "2", "1"},  
                {"3", "2", "1"},{"3", "2", "1"}, {"3", "2", "1"},  
                {"3", "2", "1"},{"3", "2", "1"}};
        rs = s.executeQuery(sql1);
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertFalse(rtsp.whatSortingRequired());
        rs = s.executeQuery(sql1);
        JDBC.assertFullResultSet(rs, result);

        sql1 = "select c.col1, b.col1, a.col1 from a, b, c where a.col1=1 "+
        "and b.col1 = 2 and c.col1=3 order by c.col2, b.col2, a.col2";
        rs = s.executeQuery(sql1);
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.whatSortingRequired());
        rs = s.executeQuery(sql1);
        JDBC.assertFullResultSet(rs, result);
    }
View Full Code Here

TOP

Related Classes of org.apache.derbyTesting.junit.RuntimeStatisticsParser$Qualifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.