use of io.hetu.core.plugin.datacenter.client.DataCenterClient in project hetu-core by openlookeng.
the class TestDataCenterClient method testShowCatalogs.
@Test
public void testShowCatalogs() {
DataCenterClient client = new DataCenterClient(this.config, httpClient, typeManager);
Set<String> catalogNames = client.getCatalogNames();
assertTrue(catalogNames.contains("tpch"));
assertEquals(catalogNames.size(), 2);
}
use of io.hetu.core.plugin.datacenter.client.DataCenterClient in project hetu-core by openlookeng.
the class TestDataCenterClient method testGetTable.
@Test
public void testGetTable() {
DataCenterClient client = new DataCenterClient(this.config, httpClient, typeManager);
DataCenterTable table = client.getTable("tpch", "tiny", "orders");
assertTrue(table.getColumns().contains(new DataCenterColumn("orderkey", BIGINT)));
assertEquals(table.getColumns().size(), 9);
}
use of io.hetu.core.plugin.datacenter.client.DataCenterClient in project hetu-core by openlookeng.
the class TestDataCenterClient method testShowSchemas.
@Test
public void testShowSchemas() {
DataCenterClient client = new DataCenterClient(this.config, httpClient, typeManager);
Set<String> schemaNames = client.getSchemaNames("tpch");
assertTrue(schemaNames.contains("tiny"));
assertEquals(schemaNames.size(), 9);
}
use of io.hetu.core.plugin.datacenter.client.DataCenterClient in project hetu-core by openlookeng.
the class TestDataCenterClient method testGetTableStatistics.
@Test
public void testGetTableStatistics() {
Map<String, ColumnHandle> columnHandles = new LinkedHashMap<>();
DataCenterClient client = new DataCenterClient(this.config, httpClient, typeManager);
columnHandles.put("orderkey", new DataCenterColumnHandle("orderkey", DOUBLE, 0));
columnHandles.put("custkey", new DataCenterColumnHandle("custkey", DOUBLE, 1));
columnHandles.put("orderstatus", new DataCenterColumnHandle("orderstatus", createVarcharType(1), 2));
columnHandles.put("totalprice", new DataCenterColumnHandle("totalprice", DOUBLE, 3));
columnHandles.put("orderdate", new DataCenterColumnHandle("orderdate", DATE, 4));
columnHandles.put("orderpriority", new DataCenterColumnHandle("orderpriority", createVarcharType(15), 5));
columnHandles.put("clerk", new DataCenterColumnHandle("clerk", createUnboundedVarcharType(), 6));
columnHandles.put("shippriority", new DataCenterColumnHandle("shippriority", DOUBLE, 7));
columnHandles.put("comment", new DataCenterColumnHandle("comment", createVarcharType(79), 8));
TableStatistics tableStatistics = client.getTableStatistics("tpch.tiny.orders", columnHandles);
assertEquals(tableStatistics.getRowCount().getValue(), 15000.0);
Map<ColumnHandle, ColumnStatistics> columnStatistics = tableStatistics.getColumnStatistics();
for (Map.Entry<ColumnHandle, ColumnStatistics> columnstatistics : columnStatistics.entrySet()) {
ColumnHandle columnhandleKey = columnstatistics.getKey();
ColumnStatistics columnhandleValue = columnstatistics.getValue();
if (columnhandleKey.getColumnName().equals("orderkey")) {
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 15000.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
assertEquals(columnhandleValue.getRange().get().getMin(), (double) 1);
assertEquals(columnhandleValue.getRange().get().getMax(), (double) 60000);
}
if (columnhandleKey.getColumnName().equals("custkey")) {
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 1000.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
assertEquals(columnhandleValue.getRange().get().getMin(), (double) 1);
assertEquals(columnhandleValue.getRange().get().getMax(), (double) 1499);
}
if (columnhandleKey.getColumnName().equals("orderstatus")) {
assertEquals(columnhandleValue.getDataSize().getValue(), 3.0);
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 3.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
}
if (columnhandleKey.getColumnName().equals("totalprice")) {
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 14996.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
assertEquals(columnhandleValue.getRange().get().getMin(), 874.89);
assertEquals(columnhandleValue.getRange().get().getMax(), 466001.28);
}
if (columnhandleKey.getColumnName().equals("orderdate")) {
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 2401.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
assertEquals(columnhandleValue.getRange().get().getMin(), (double) 8035);
assertEquals(columnhandleValue.getRange().get().getMax(), (double) 10440);
}
if (columnhandleKey.getColumnName().equals("orderpriority")) {
assertEquals(columnhandleValue.getDataSize().getValue(), 42.0);
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 5.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
}
if (columnhandleKey.getColumnName().equals("clerk")) {
assertEquals(columnhandleValue.getDataSize().getValue(), 15000.0);
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 1000.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
}
if (columnhandleKey.getColumnName().equals("shippriority")) {
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 1.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
assertEquals(columnhandleValue.getRange().get().getMin(), (double) 0);
assertEquals(columnhandleValue.getRange().get().getMax(), (double) 0);
}
if (columnhandleKey.getColumnName().equals("comment")) {
assertEquals(columnhandleValue.getDataSize().getValue(), 727249.0);
assertEquals(columnhandleValue.getDistinctValuesCount().getValue(), 14995.0);
assertEquals(columnhandleValue.getNullsFraction().getValue(), 0.0);
}
}
}
use of io.hetu.core.plugin.datacenter.client.DataCenterClient in project hetu-core by openlookeng.
the class TestDataCenterClient method testShowTables.
@Test
public void testShowTables() {
DataCenterClient client = new DataCenterClient(this.config, httpClient, typeManager);
Set<String> tableNames = client.getTableNames("tpch", "tiny");
assertTrue(tableNames.contains("orders"));
assertEquals(tableNames.size(), 8);
}
Aggregations