use of org.apache.drill.exec.proto.UserProtos.GetServerMetaResp in project drill by apache.
the class DrillDatabaseMetaDataImpl method getServerMeta.
private ServerMeta getServerMeta() throws SQLException {
assert getServerMetaSupported();
if (serverMeta == null) {
synchronized (this) {
if (serverMeta == null) {
DrillConnectionImpl connection = (DrillConnectionImpl) getConnection();
try {
GetServerMetaResp resp = connection.getClient().getServerMeta().get();
if (resp.getStatus() != RequestStatus.OK) {
DrillPBError drillError = resp.getError();
throw new SQLException("Error when getting server meta: " + drillError.getMessage());
}
serverMeta = resp.getServerMeta();
convertSupport = SQLConvertSupport.toSQLConvertSupport(serverMeta.getConvertSupportList());
} catch (InterruptedException e) {
throw new SQLException("Interrupted when getting server meta", e);
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause == null) {
throw new AssertionError("Something unknown happened", e);
}
Throwables.propagateIfPossible(cause);
throw new SQLException("Error when getting server meta", cause);
}
}
}
}
return serverMeta;
}
use of org.apache.drill.exec.proto.UserProtos.GetServerMetaResp in project drill by apache.
the class TestServerMetaProvider method testServerMeta.
@Test
public void testServerMeta() throws Exception {
GetServerMetaResp resp = client.getServerMeta().get();
assertNotNull(resp);
assertEquals(RequestStatus.OK, resp.getStatus());
assertNotNull(resp.getServerMeta());
ServerMeta serverMeta = resp.getServerMeta();
logger.trace("Server metadata: {}", serverMeta);
assertEquals(Quoting.BACK_TICK.string, serverMeta.getIdentifierQuoteString());
}
Aggregations