Search in sources :

Example 81 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysOperationsTest method testDistinctSysOperations.

@Test
public void testDistinctSysOperations() throws Exception {
    // this tests a distributing collect without shards but DOC level granularity
    SQLResponse response = execute("select distinct name  from sys.operations limit 1");
    assertThat(response.rowCount(), is(1L));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 82 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectGroupByWhereTable.

@Test
public void testSelectGroupByWhereTable() throws Exception {
    SQLResponse response = execute("" + "select count(*), num_docs from sys.shards where table_name = 'characters' " + "group by num_docs order by count(*)");
    assertThat(response.rowCount(), greaterThan(0L));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 83 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectStarIn.

@Test
public void testSelectStarIn() throws Exception {
    SQLResponse response = execute("select * from sys.shards where table_name in ('characters')");
    assertEquals(8L, response.rowCount());
    assertEquals(15, response.cols().length);
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 84 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectStarAllTables.

@Test
public void testSelectStarAllTables() throws Exception {
    SQLResponse response = execute("select * from sys.shards");
    assertEquals(26L, response.rowCount());
    assertEquals(15, response.cols().length);
    assertThat(response.cols(), arrayContaining("blob_path", "id", "min_lucene_version", "num_docs", "orphan_partition", "partition_ident", "path", "primary", "recovery", "relocating_node", "routing_state", "schema_name", "size", "state", "table_name"));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 85 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectGlobalCount.

@Test
public void testSelectGlobalCount() throws Exception {
    SQLResponse response = execute("select count(*) from sys.shards");
    assertEquals(1L, response.rowCount());
    assertEquals(26L, response.rows()[0][0]);
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Aggregations

SQLResponse (io.crate.testing.SQLResponse)109 Test (org.junit.Test)78 Map (java.util.Map)13 UseJdbc (io.crate.testing.UseJdbc)10 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)8 PartitionName (io.crate.metadata.PartitionName)4 TestingHelpers.resolveCanonicalString (io.crate.testing.TestingHelpers.resolveCanonicalString)4 Path (java.nio.file.Path)4 BytesRef (org.apache.lucene.util.BytesRef)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 TreeMap (java.util.TreeMap)2 List (java.util.List)1 UUID (java.util.UUID)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ClusterRerouteRequestBuilder (org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteRequestBuilder)1 ClusterStateResponse (org.elasticsearch.action.admin.cluster.state.ClusterStateResponse)1 SearchRequest (org.elasticsearch.action.search.SearchRequest)1 SearchResponse (org.elasticsearch.action.search.SearchResponse)1