Examples of cols()


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

    @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 {
        SQLResponse response = transportExecutor.exec(
View Full Code Here

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

    @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

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

        ensureGreen();

        SQLResponse r = client.sql("select \"_id\" from test").actionGet();

        assertEquals(1, r.rows().length);
        assertEquals("_id", r.cols()[0]);
        assertEquals("1", r.rows()[0][0]);

        assertThat(r.columnTypes(), is(new DataType[0]));

        System.out.println(Arrays.toString(r.cols()));
View Full Code Here

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

        assertEquals("_id", r.cols()[0]);
        assertEquals("1", r.rows()[0][0]);

        assertThat(r.columnTypes(), is(new DataType[0]));

        System.out.println(Arrays.toString(r.cols()));
        for (Object[] row: r.rows()){
            System.out.println(Arrays.toString(row));
        }

    }
View Full Code Here

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

        SQLRequest request =  new SQLRequest("select \"_id\" from test");
        request.includeTypesOnResponse(true);
        SQLResponse r = client.sql(request).actionGet();

        assertEquals(1, r.rows().length);
        assertEquals("_id", r.cols()[0]);
        assertEquals("1", r.rows()[0][0]);

        assertThat(r.columnTypes()[0], instanceOf(StringType.class));

        System.out.println(Arrays.toString(r.cols()));
View Full Code Here

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

        assertEquals("_id", r.cols()[0]);
        assertEquals("1", r.rows()[0][0]);

        assertThat(r.columnTypes()[0], instanceOf(StringType.class));

        System.out.println(Arrays.toString(r.cols()));
        for (Object[] row: r.rows()){
            System.out.println(Arrays.toString(row));
        }

    }
View Full Code Here

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

    private void assertResponseWithTypes(String stmt) {
        SQLRequest request = new SQLRequest(stmt);
        request.includeTypesOnResponse(true);
        SQLResponse sqlResponse = sqlExecutor.exec(request);
        assertThat(sqlResponse.columnTypes(), is(notNullValue()));
        assertThat(sqlResponse.columnTypes().length, is(sqlResponse.cols().length));
    }

    @Test
    public void testSubscriptArray() throws Exception {
        execute("create table test (id integer primary key, names array(string)) " +
View Full Code Here

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

    }

    @Test
    public void testArithmeticFunctions() throws Exception {
        SQLResponse response = executor.exec("select ((2 * 4 - 2 + 1) / 2) % 3 from sys.cluster");
        assertThat(response.cols()[0], is("(((((2 * 4) - 2) + 1) / 2) % 3)"));
        assertThat((Long)response.rows()[0][0], is(0L));

        response = executor.exec("select ((2 * 4.0 - 2 + 1) / 2) % 3 from sys.cluster");
        assertThat((Double)response.rows()[0][0], is(0.5));

View Full Code Here

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

    @Test
    public void testSelectGlobalExpressionGlobalAggregate() throws Exception {
        SQLResponse response = executor.exec("select count(distinct race), sys.cluster.name " +
                "from characters group by sys.cluster.name");
        assertEquals(1, response.rowCount());
        assertArrayEquals(new String[]{"count(DISTINCT race)", "sys.cluster.name"}, response.cols());
        assertEquals(3L, response.rows()[0][0]);
        assertEquals(GLOBAL_CLUSTER.clusterName(), response.rows()[0][1]);
    }

    @Test
View Full Code Here

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

    @Test
    public void testGlobalAggregateSimple() throws Exception {
        SQLResponse response = executor.exec("select max(age) from characters");

        assertEquals(1, response.rowCount());
        assertEquals("max(age)", response.cols()[0]);
        assertEquals(112, response.rows()[0][0]);

        response = executor.exec("select min(name) from characters");

        assertEquals(1, response.rowCount());
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.