use of org.apache.drill.exec.proto.UserProtos.GetSchemasResp in project drill by apache.
the class DrillMetaImpl method serverGetSchemas.
private MetaResultSet serverGetSchemas(String catalog, Pat schemaPattern) {
final LikeFilter catalogNameFilter = newLikeFilter(quote(catalog));
final LikeFilter schemaNameFilter = newLikeFilter(schemaPattern);
return new MetadataAdapter<MetaImpl.MetaSchema, GetSchemasResp, SchemaMetadata>(MetaImpl.MetaSchema.class) {
@Override
protected RequestStatus getStatus(GetSchemasResp response) {
return response.getStatus();
}
@Override
protected List<SchemaMetadata> getResult(GetSchemasResp response) {
return response.getSchemasList();
}
@Override
protected DrillPBError getError(GetSchemasResp response) {
return response.getError();
}
@Override
protected MetaSchema adapt(SchemaMetadata value) {
return new MetaImpl.MetaSchema(value.getCatalogName(), value.getSchemaName());
}
}.getMeta(connection.getClient().getSchemas(catalogNameFilter, schemaNameFilter));
}
use of org.apache.drill.exec.proto.UserProtos.GetSchemasResp in project drill by apache.
the class TestMetadataProvider method schemas.
@Test
public void schemas() throws Exception {
// test("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA"); // SQL equivalent
GetSchemasResp resp = client.getSchemas(null, null).get();
assertEquals(RequestStatus.OK, resp.getStatus());
List<SchemaMetadata> schemas = resp.getSchemasList();
assertEquals(9, schemas.size());
verifySchema("INFORMATION_SCHEMA", schemas);
verifySchema("cp.default", schemas);
verifySchema("dfs.default", schemas);
verifySchema("dfs.root", schemas);
verifySchema("dfs.tmp", schemas);
verifySchema("dfs_test.default", schemas);
verifySchema("dfs_test.home", schemas);
verifySchema("dfs_test.tmp", schemas);
verifySchema("sys", schemas);
}
use of org.apache.drill.exec.proto.UserProtos.GetSchemasResp in project drill by apache.
the class TestMetadataProvider method schemasWithCatalogNameFilterAndSchemaNameFilter.
@Test
public void schemasWithCatalogNameFilterAndSchemaNameFilter() throws Exception {
// test("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA " +
// "WHERE CATALOG_NAME LIKE '%RI%' AND SCHEMA_NAME LIKE '%y%'"); // SQL equivalent
GetSchemasResp resp = client.getSchemas(LikeFilter.newBuilder().setPattern("%RI%").build(), LikeFilter.newBuilder().setPattern("%dfs_test%").build()).get();
assertEquals(RequestStatus.OK, resp.getStatus());
List<SchemaMetadata> schemas = resp.getSchemasList();
assertEquals(3, schemas.size());
verifySchema("dfs_test.default", schemas);
verifySchema("dfs_test.home", schemas);
verifySchema("dfs_test.tmp", schemas);
}
use of org.apache.drill.exec.proto.UserProtos.GetSchemasResp in project drill by apache.
the class TestMetadataProvider method schemasWithSchemaNameFilter.
@Test
public void schemasWithSchemaNameFilter() throws Exception {
// test("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE '%y%'"); // SQL equivalent
GetSchemasResp resp = client.getSchemas(null, LikeFilter.newBuilder().setPattern("%y%").build()).get();
assertEquals(RequestStatus.OK, resp.getStatus());
List<SchemaMetadata> schemas = resp.getSchemasList();
assertEquals(1, schemas.size());
verifySchema("sys", schemas);
}
Aggregations