Package io.crate.action.sql

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


    @Test
    public void testSysNodesObjectArrayStringChildColumn() throws Exception {
        SQLResponse response = executor.exec("select fs['data']['path'] from sys.nodes");
        assertThat(response.rowCount(), Matchers.is(2L));
        for (Object path : (Object[])response.rows()[0][0]) {
            assertThat(path, instanceOf(String.class));
        }
    }

    @Test
View Full Code Here


    public void testVersion() throws Exception {
        SQLResponse response = executor.exec("select version, version['number'], " +
                "version['build_hash'], version['build_snapshot'] " +
                "from sys.nodes limit 1");
        assertThat(response.rowCount(), is(1L));
        assertThat(response.rows()[0][0], instanceOf(Map.class));
        assertThat((Map<String, Object>)response.rows()[0][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
        assertThat((String)response.rows()[0][1], is(Version.CURRENT.number()));
        assertThat(response.rows()[0][2], instanceOf(String.class));
        assertThat((Boolean)response.rows()[0][3], is(Version.CURRENT.snapshot()));
    }
View Full Code Here

        SQLResponse response = executor.exec("select version, version['number'], " +
                "version['build_hash'], version['build_snapshot'] " +
                "from sys.nodes limit 1");
        assertThat(response.rowCount(), is(1L));
        assertThat(response.rows()[0][0], instanceOf(Map.class));
        assertThat((Map<String, Object>)response.rows()[0][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
        assertThat((String)response.rows()[0][1], is(Version.CURRENT.number()));
        assertThat(response.rows()[0][2], instanceOf(String.class));
        assertThat((Boolean)response.rows()[0][3], is(Version.CURRENT.snapshot()));
    }
View Full Code Here

                "version['build_hash'], version['build_snapshot'] " +
                "from sys.nodes limit 1");
        assertThat(response.rowCount(), is(1L));
        assertThat(response.rows()[0][0], instanceOf(Map.class));
        assertThat((Map<String, Object>)response.rows()[0][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
        assertThat((String)response.rows()[0][1], is(Version.CURRENT.number()));
        assertThat(response.rows()[0][2], instanceOf(String.class));
        assertThat((Boolean)response.rows()[0][3], is(Version.CURRENT.snapshot()));
    }

    @Test
View Full Code Here

                "from sys.nodes limit 1");
        assertThat(response.rowCount(), is(1L));
        assertThat(response.rows()[0][0], instanceOf(Map.class));
        assertThat((Map<String, Object>)response.rows()[0][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
        assertThat((String)response.rows()[0][1], is(Version.CURRENT.number()));
        assertThat(response.rows()[0][2], instanceOf(String.class));
        assertThat((Boolean)response.rows()[0][3], is(Version.CURRENT.snapshot()));
    }

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

        assertThat(response.rowCount(), is(1L));
        assertThat(response.rows()[0][0], instanceOf(Map.class));
        assertThat((Map<String, Object>)response.rows()[0][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
        assertThat((String)response.rows()[0][1], is(Version.CURRENT.number()));
        assertThat(response.rows()[0][2], instanceOf(String.class));
        assertThat((Boolean)response.rows()[0][3], is(Version.CURRENT.snapshot()));
    }

    @Test
    public void testRegexpMatchOnNode() throws Exception {
        SQLResponse response = executor.exec("select name from sys.nodes where name ~ 'node_[0-9]{1,2}' order by name");
View Full Code Here

    @Test
    public void testRegexpMatchOnNode() throws Exception {
        SQLResponse response = executor.exec("select name from sys.nodes where name ~ 'node_[0-9]{1,2}' order by name");
        assertThat(response.rowCount(), is(2L));
        assertThat((String)response.rows()[0][0], is("node_0"));
        assertThat((String)response.rows()[1][0], is("node_1"));
    }
}
View Full Code Here

    @Test
    public void testRegexpMatchOnNode() throws Exception {
        SQLResponse response = executor.exec("select name from sys.nodes where name ~ 'node_[0-9]{1,2}' order by name");
        assertThat(response.rowCount(), is(2L));
        assertThat((String)response.rows()[0][0], is("node_0"));
        assertThat((String)response.rows()[1][0], is("node_1"));
    }
}
View Full Code Here

    @Test
    public void testRefreshSystemTable() throws Exception {
        SQLResponse response = executor.exec("refresh table sys.shards");
        assertFalse(response.hasRowCount());
        assertThat(response.rows(), is(TaskResult.EMPTY_RESULT.rows()));
    }

    @Test
    public void testSelectNonExistentGlobalExpression() throws Exception {
        expectedException.expect(SQLActionException.class);
View Full Code Here

    }

    @Test
    public void testSelectOrderByNullSortingASC() throws Exception {
        SQLResponse response = executor.exec("select age from characters order by age");
        assertEquals(32, response.rows()[0][0]);
        assertEquals(34, response.rows()[1][0]);
        assertEquals(43, response.rows()[2][0]);
        assertEquals(112, response.rows()[3][0]);
        assertEquals(null, response.rows()[4][0]);
        assertEquals(null, response.rows()[5][0]);
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.