Package io.crate.action.sql

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


    @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


    }

    @Test
    public void testSelectGreaterThan() throws Exception {
        SQLResponse response = transportExecutor.exec("select * from sys.shards where num_docs > 0");
        assertThat(response.rowCount(), greaterThan(0L));
    }

    @Test
    public void testSelectWhereBoolean() throws Exception {
        SQLResponse response = transportExecutor.exec("select * from sys.shards where \"primary\" = false");
View Full Code Here

    }

    @Test
    public void testSelectWhereBoolean() throws Exception {
        SQLResponse response = transportExecutor.exec("select * from sys.shards where \"primary\" = false");
        assertEquals(15L, response.rowCount());
    }

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

    @Test
    public void testSelectGlobalAggregates() throws Exception {
        SQLResponse response = transportExecutor.exec(
            "select sum(size), min(size), max(size), avg(size) from sys.shards");
        assertEquals(1L, response.rowCount());
        assertEquals(4, response.rows()[0].length);
        assertNotNull(response.rows()[0][0]);
        assertNotNull(response.rows()[0][1]);
        assertNotNull(response.rows()[0][2]);
        assertNotNull(response.rows()[0][3]);
View Full Code Here

    }

    @Test
    public void testSelectGlobalCount() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*) from sys.shards");
        assertEquals(1L, response.rowCount());
        assertEquals(30L, response.rows()[0][0]);
    }

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

    }

    @Test
    public void testSelectGlobalCountAndOthers() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*), max(table_name) from sys.shards");
        assertEquals(1L, response.rowCount());
        assertEquals(30L, response.rows()[0][0]);
        assertEquals("quotes", response.rows()[0][1]);
    }

    @Test
View Full Code Here

    @Test
    public void testSelectGlobalExpressionGroupBy() throws Exception {
        SQLResponse response = transportExecutor.exec("select count(*), table_name, sys.cluster.name from sys.shards " +
            "group by sys.cluster.name, table_name order by table_name");
        assertEquals(3, response.rowCount());
        assertEquals(10L, response.rows()[0][0]);
        assertEquals("blobs", response.rows()[0][1]);
        assertEquals(GLOBAL_CLUSTER.clusterName(), response.rows()[0][2]);

        assertEquals(10L, response.rows()[1][0]);
View Full Code Here

    public void testDeleteFromPartitionedTableUnknownPartition() throws Exception {
        this.setup.partitionTableSetup();
        SQLResponse response = execute("select partition_ident from information_schema.table_partitions " +
                "where table_name='parted' and schema_name='doc'" +
                "order by partition_ident");
        assertThat(response.rowCount(), is(2L));
        assertThat((String)response.rows()[0][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1388534400000"))).ident()));
        assertThat((String)response.rows()[1][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1391212800000"))).ident()));

        execute("delete from parted where date = '2014-03-01'");
        refresh();
View Full Code Here

        this.setup.partitionTableSetup();

        SQLResponse response = execute("select partition_ident from information_schema.table_partitions " +
                "where table_name='parted' and schema_name='doc'" +
                "order by partition_ident");
        assertThat(response.rowCount(), is(2L));
        assertThat((String)response.rows()[0][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1388534400000"))).ident()));
        assertThat((String)response.rows()[1][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1391212800000"))).ident()));

        execute("delete from parted where o['dat'] = '2014-03-01'");
        refresh();
View Full Code Here

        refresh();

        SQLResponse response = execute("select partition_ident from information_schema.table_partitions " +
                "where table_name='quotes' and schema_name='doc'" +
                "order by partition_ident");
        assertThat(response.rowCount(), is(3L));
        assertThat((String)response.rows()[0][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395874800000"))).ident()));
        assertThat((String)response.rows()[1][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1395961200000"))).ident()));
        assertThat((String)response.rows()[2][0], is(new PartitionName("parted", ImmutableList.of(new BytesRef("1396303200000"))).ident()));

        execute("delete from quotes where quote = 'Don''t panic'");
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.