Package io.crate.action.sql

Examples of io.crate.action.sql.SQLResponse.rowCount()


    @Test
    public void testSelectGroupByWhereTable() throws Exception {
        SQLResponse response = transportExecutor.exec("" +
            "select count(*), num_docs from sys.shards where table_name = 'characters' " +
            "group by num_docs order by count(*)");
        assertThat(response.rowCount(), greaterThan(0L));
    }

    @Test
    public void testSelectGroupByAllTables() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*), table_name from sys.shards " +
View Full Code Here


    @Test
    public void testSelectGroupByAllTables() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*), table_name from sys.shards " +
            "group by table_name order by table_name");
        assertEquals(3L, response.rowCount());
        assertEquals(10L, response.rows()[0][0]);
        assertEquals("blobs", response.rows()[0][1]);
        assertEquals("characters", response.rows()[1][1]);
        assertEquals("quotes", response.rows()[2][1]);
    }
View Full Code Here

    @Test
    public void testSelectGroupByWhereNotLike() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*), table_name from sys.shards " +
            "where table_name not like 'my_table%' group by table_name order by table_name");
        assertEquals(3L, response.rowCount());
        assertEquals(10L, response.rows()[0][0]);
        assertEquals("blobs", response.rows()[0][1]);
        assertEquals(10L, response.rows()[1][0]);
        assertEquals("characters", response.rows()[1][1]);
        assertEquals(10L, response.rows()[2][0]);
View Full Code Here

    @Test
    public void testSelectWhereTable() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select id, sys.nodes.name, size from sys.shards " +
            "where table_name = 'characters'");
        assertEquals(10L, response.rowCount());
    }

    @Test
    public void testSelectStarWhereTable() throws Exception {
        SQLResponse response = transportExecutor.exec(
View Full Code Here

    @Test
    public void testSelectStarWhereTable() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select * from sys.shards where table_name = 'characters'");
        assertEquals(10L, response.rowCount());
        assertEquals(10, response.cols().length);
    }

    @Test
    public void testSelectStarAllTables() throws Exception {
View Full Code Here

    }

    @Test
    public void testSelectStarAllTables() throws Exception {
        SQLResponse response = transportExecutor.exec("select * from sys.shards");
        assertEquals(30L, response.rowCount());
        assertEquals(10, response.cols().length);
        assertEquals("schema_name, table_name, id, partition_ident, num_docs, primary, relocating_node, size, state, orphan_partition",
            Joiner.on(", ").join(response.cols()));
    }

View Full Code Here

    @Test
    public void testSelectStarLike() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select * from sys.shards where table_name like 'charact%'");
        assertEquals(10L, response.rowCount());
        assertEquals(10, response.cols().length);
    }

    @Test
    public void testSelectStarNotLike() throws Exception {
View Full Code Here

    @Test
    public void testSelectStarNotLike() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select * from sys.shards where table_name not like 'quotes%'");
        assertEquals(20L, response.rowCount());
        assertEquals(10, response.cols().length);
    }

    @Test
    public void testSelectStarIn() throws Exception {
View Full Code Here

    @Test
    public void testSelectStarIn() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select * from sys.shards where table_name in ('characters')");
        assertEquals(10L, response.rowCount());
        assertEquals(10, response.cols().length);
    }

    @Test
    public void testSelectStarMatch() throws Exception {
View Full Code Here

    }

    @Test
    public void testSelectOrderBy() throws Exception {
        SQLResponse response = transportExecutor.exec("select * from sys.shards order by table_name");
        assertEquals(30L, response.rowCount());
        String[] tableNames = {"blobs", "characters", "quotes"};
        for (int i=0; i<response.rowCount(); i++) {
            int idx = i/10;
            assertEquals(tableNames[idx], response.rows()[i][1]);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.