final String errMsgFromServer = resp.getError() != null ? resp.getError().getMessage() : "";
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.DrillPBError other) { if (other == org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) return this; if (other.hasErrorId()) { bitField0_ |= 0x00000001; errorId_ = other.errorId_; onChanged(); if (other.hasEndpoint()) { mergeEndpoint(other.getEndpoint()); if (other.hasErrorType()) { setErrorType(other.getErrorType()); if (other.hasMessage()) { bitField0_ |= 0x00000008; message_ = other.message_; onChanged(); if (other.hasException()) { mergeException(other.getException()); this.mergeUnknownFields(other.getUnknownFields()); return this;
public org.apache.drill.exec.proto.UserBitShared.DrillPBError buildPartial() { org.apache.drill.exec.proto.UserBitShared.DrillPBError result = new org.apache.drill.exec.proto.UserBitShared.DrillPBError(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
final String errMsgFromServer = resp.getError() != null ? resp.getError().getMessage() : "";
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.DrillPBError other) { if (other == org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) return this; if (other.hasErrorId()) { bitField0_ |= 0x00000001; errorId_ = other.errorId_; onChanged(); if (other.hasEndpoint()) { mergeEndpoint(other.getEndpoint()); if (other.hasErrorType()) { setErrorType(other.getErrorType()); if (other.hasMessage()) { bitField0_ |= 0x00000008; message_ = other.message_; onChanged(); if (other.hasException()) { mergeException(other.getException()); this.mergeUnknownFields(other.getUnknownFields()); return this;
public org.apache.drill.exec.proto.UserBitShared.DrillPBError buildPartial() { org.apache.drill.exec.proto.UserBitShared.DrillPBError result = new org.apache.drill.exec.proto.UserBitShared.DrillPBError(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
throw new DrillRuntimeException(new SQLException("Failure getting metadata: " + error.getMessage()));
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.throwIfUnchecked(cause); throw new SQLException("Error when getting server meta", cause); } } } } return serverMeta; }
/** * returns or creates a DrillPBError object corresponding to this user exception. * * @param verbose should the error object contain the verbose error message ? * @return protobuf error object */ public DrillPBError getOrCreatePBError(final boolean verbose) { final String message = verbose ? getVerboseMessage() : getMessage(); final DrillPBError.Builder builder = DrillPBError.newBuilder(); builder.setErrorType(errorType); builder.setErrorId(context.getErrorId()); if (context.getEndpoint() != null) { builder.setEndpoint(context.getEndpoint()); } builder.setMessage(message); if (getCause() != null) { // some unit tests use this information to make sure a specific exception was thrown in the server builder.setException(ErrorHelper.getWrapper(getCause())); } else { // not a wrapper exception builder.setException(ErrorHelper.getWrapper(this)); } return builder.build(); }
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserProtos.GetCatalogsResp.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setStatus(org.apache.drill.exec.proto.UserProtos.RequestStatus.valueOf(input.readEnum())); break; case 2: builder.addCatalogs(input.mergeObject(org.apache.drill.exec.proto.UserProtos.CatalogMetadata.newBuilder(), org.apache.drill.exec.proto.SchemaUserProtos.CatalogMetadata.MERGE)); break; case 3: builder.setError(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.DrillPBError.MERGE)); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.GetCatalogsResp.Builder builder)
/** * Helper method to create {@link DrillPBError} and set it in <code>respBuilder</code> */ private static void setErrorHelper(final CreatePreparedStatementResp.Builder respBuilder, final RequestStatus status, final Throwable ex, final String message, final ErrorType errorType) { respBuilder.setStatus(status); final String errorId = UUID.randomUUID().toString(); if (ex != null) { logger.error("{} ErrorId: {}", message, errorId, ex); } else { logger.error("{} ErrorId: {}", message, errorId); } final DrillPBError.Builder builder = DrillPBError.newBuilder(); builder.setErrorType(errorType); builder.setErrorId(errorId); builder.setMessage(message); if (ex != null) { builder.setException(ErrorHelper.getWrapper(ex)); } respBuilder.setError(builder.build()); }
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserBitShared.QueryResult.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setQueryState(org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState.valueOf(input.readEnum())); break; case 2: builder.setQueryId(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.QueryId.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.QueryId.MERGE)); break; case 3: builder.addError(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.DrillPBError.MERGE)); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryResult.Builder builder)
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserProtos.GetTablesResp.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setStatus(org.apache.drill.exec.proto.UserProtos.RequestStatus.valueOf(input.readEnum())); break; case 2: builder.addTables(input.mergeObject(org.apache.drill.exec.proto.UserProtos.TableMetadata.newBuilder(), org.apache.drill.exec.proto.SchemaUserProtos.TableMetadata.MERGE)); break; case 3: builder.setError(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.DrillPBError.MERGE)); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.GetTablesResp.Builder builder)
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserProtos.CreatePreparedStatementResp.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setStatus(org.apache.drill.exec.proto.UserProtos.RequestStatus.valueOf(input.readEnum())); break; case 2: builder.setPreparedStatement(input.mergeObject(org.apache.drill.exec.proto.UserProtos.PreparedStatement.newBuilder(), org.apache.drill.exec.proto.SchemaUserProtos.PreparedStatement.MERGE)); break; case 3: builder.setError(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.DrillPBError.MERGE)); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.CreatePreparedStatementResp.Builder builder)
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserProtos.GetSchemasResp.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setStatus(org.apache.drill.exec.proto.UserProtos.RequestStatus.valueOf(input.readEnum())); break; case 2: builder.addSchemas(input.mergeObject(org.apache.drill.exec.proto.UserProtos.SchemaMetadata.newBuilder(), org.apache.drill.exec.proto.SchemaUserProtos.SchemaMetadata.MERGE)); break; case 3: builder.setError(input.mergeObject(org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(), org.apache.drill.exec.proto.SchemaUserBitShared.DrillPBError.MERGE)); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.GetSchemasResp.Builder builder)
/** * Helper method to create {@link DrillPBError} for client response message. * @param failedFunction Brief description of the failed function. * @param ex Exception thrown * @return */ static DrillPBError createPBError(final String failedFunction, final Throwable ex) { final String errorId = UUID.randomUUID().toString(); logger.error("Failed to {}. ErrorId: {}", failedFunction, errorId, ex); final DrillPBError.Builder builder = DrillPBError.newBuilder(); builder.setErrorType(ErrorType.SYSTEM); // Metadata requests shouldn't cause any user errors builder.setErrorId(errorId); if (ex.getMessage() != null) { builder.setMessage(ex.getMessage()); } builder.setException(ErrorHelper.getWrapper(ex)); return builder.build(); } }
/** * <code>optional .exec.shared.DrillPBError error = 3;</code> */ public Builder mergeError(org.apache.drill.exec.proto.UserBitShared.DrillPBError value) { if (errorBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && error_ != org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) { error_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(error_).mergeFrom(value).buildPartial(); } else { error_ = value; } onChanged(); } else { errorBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /**
/** * <code>optional .exec.shared.DrillPBError error = 3;</code> */ public Builder mergeError(org.apache.drill.exec.proto.UserBitShared.DrillPBError value) { if (errorBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && error_ != org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) { error_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(error_).mergeFrom(value).buildPartial(); } else { error_ = value; } onChanged(); } else { errorBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /**
/** * <code>optional .exec.shared.DrillPBError error = 3;</code> */ public Builder mergeError(org.apache.drill.exec.proto.UserBitShared.DrillPBError value) { if (errorBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && error_ != org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) { error_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(error_).mergeFrom(value).buildPartial(); } else { error_ = value; } onChanged(); } else { errorBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /**
/** * <code>optional .exec.shared.DrillPBError error = 3;</code> */ public Builder mergeError(org.apache.drill.exec.proto.UserBitShared.DrillPBError value) { if (errorBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && error_ != org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDefaultInstance()) { error_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.newBuilder(error_).mergeFrom(value).buildPartial(); } else { error_ = value; } onChanged(); } else { errorBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /**