Package io.crate.action.sql

Examples of io.crate.action.sql.SQLResponse


        }
    }

    @Test
    public void testSelectGlobalExpressionGroupByWith2GroupByKeys() throws Exception {
        SQLResponse response = executor.exec(
            "select count(name), sys.cluster.name from characters " +
                "group by race, sys.cluster.name order by count(name) desc");
        assertEquals(3, response.rowCount());
        assertEquals(4L, response.rows()[0][0]);
        assertEquals(GLOBAL_CLUSTER.clusterName(), response.rows()[0][1]);
        assertEquals(response.rows()[0][1], response.rows()[1][1]);
        assertEquals(response.rows()[0][1], response.rows()[2][1]);
    }
View Full Code Here


        }
    }

    @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));
    }
View Full Code Here

        assertThat(response.rowCount(), greaterThan(0L));
    }

    @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

        assertEquals("quotes", response.rows()[2][1]);
    }

    @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]);
        assertEquals("quotes", response.rows()[2][1]);
    }
View Full Code Here

        assertEquals("quotes", response.rows()[2][1]);
    }

    @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());
    }
View Full Code Here

        assertEquals(10L, response.rowCount());
    }

    @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);
    }
View Full Code Here

        assertEquals(10, response.cols().length);
    }

    @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

            Joiner.on(", ").join(response.cols()));
    }

    @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);
    }
View Full Code Here

        assertEquals(10, response.cols().length);
    }

    @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);
    }
View Full Code Here

        assertEquals(10, response.cols().length);
    }

    @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);
    }
View Full Code Here

TOP

Related Classes of io.crate.action.sql.SQLResponse

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.