ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
static BigQueryError fromPb(ErrorProto errorPb) { return new BigQueryError( errorPb.getReason(), errorPb.getLocation(), errorPb.getMessage(), errorPb.getDebugInfo()); } }
private TableDataInsertAllResponse.InsertErrors generateErrorAmongMany( int numErrors, String baseReason, String exceptionalReason) { // The retry policies are expected to search through the entire list of ErrorProtos to determine // whether to retry. Stick the exceptionalReason in a random position to exercise this. List<ErrorProto> errorProtos = Lists.newArrayListWithExpectedSize(numErrors); int exceptionalPosition = ThreadLocalRandom.current().nextInt(numErrors); for (int i = 0; i < numErrors; ++i) { ErrorProto error = new ErrorProto(); error.setReason((i == exceptionalPosition) ? exceptionalReason : baseReason); errorProtos.add(error); } TableDataInsertAllResponse.InsertErrors errors = new TableDataInsertAllResponse.InsertErrors(); errors.setErrors(errorProtos); return errors; } }
new TableDataInsertAllResponse.InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setMessage("ErrorMessage"))))); EasyMock.expect(bigqueryRpcMock.insertAll(OTHER_PROJECT, DATASET, TABLE, requestPb)) .andReturn(responsePb);
for (InsertErrors errorSet : insertErrors) { for (ErrorProto singleError : errorSet.getErrors()) { String reason = singleError.getReason() + "~" + singleError.getMessage(); if (reasonCounts.get(reason) == null) { reasonCounts.put(reason, 0); if ("Maximum allowed row size exceeded".equals(singleError.getMessage())) { Map<String, Object> row = rows.get(i); for (String k : row.keySet()) {
/** Tests that {@link BigQueryServicesImpl.JobServiceImpl#pollJob} fails. */ @Test public void testPollJobFailed() throws IOException, InterruptedException { Job testJob = new Job(); testJob.setStatus(new JobStatus().setState("DONE").setErrorResult(new ErrorProto())); when(response.getContentType()).thenReturn(Json.MEDIA_TYPE); when(response.getStatusCode()).thenReturn(200); when(response.getContent()).thenReturn(toStream(testJob)); BigQueryServicesImpl.JobServiceImpl jobService = new BigQueryServicesImpl.JobServiceImpl(bigquery); JobReference jobRef = new JobReference().setProjectId("projectId").setJobId("jobId"); Job job = jobService.pollJob(jobRef, Sleeper.DEFAULT, BackOff.ZERO_BACKOFF); assertEquals(testJob, job); verify(response, times(1)).getStatusCode(); verify(response, times(1)).getContent(); verify(response, times(1)).getContentType(); }
"Executing query %s failed: %s", queryConfig.toPrettyString(), error.getMessage()));
new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout"))), new InsertErrors() .setIndex(1L) .setErrors(ImmutableList.of(new ErrorProto().setReason("invalid")))));
new TableDataInsertAllResponse.InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setMessage("ErrorMessage"))))); EasyMock.expect( bigqueryRpcMock.insertAll("project-different-from-option", DATASET, TABLE, requestPb))
.setInsertErrors( ImmutableList.of( new InsertErrors().setIndex(1L).setErrors(ImmutableList.of(new ErrorProto()))));
ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
static BigQueryError fromPb(ErrorProto errorPb) { return new BigQueryError(errorPb.getReason(), errorPb.getLocation(), errorPb.getMessage(), errorPb.getDebugInfo()); } }
new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout"))), new InsertErrors() .setIndex(1L) .setErrors(ImmutableList.of(new ErrorProto().setReason("invalid"))))); new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout")))));
new TableDataInsertAllResponse.InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setMessage("ErrorMessage"))))); EasyMock.expect(bigqueryRpcMock.insertAll(PROJECT, DATASET, TABLE, requestPb)) .andThrow(new BigQueryException(500, "InternalError"));
Table existingTable = datasetService.getTable(destination); if (!validateDispositions(existingTable, createDisposition, writeDisposition)) { return new JobStatus().setState("FAILED").setErrorResult(new ErrorProto()); if (!first) { if (!Objects.equals(partitioning, table.getTimePartitioning())) { return new JobStatus().setState("FAILED").setErrorResult(new ErrorProto()); return new JobStatus().setState("FAILED").setErrorResult(new ErrorProto());
ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
static BigQueryError fromPb(ErrorProto errorPb) { return new BigQueryError(errorPb.getReason(), errorPb.getLocation(), errorPb.getMessage(), errorPb.getDebugInfo()); } }
new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout"))), new InsertErrors() .setIndex(1L) .setErrors(ImmutableList.of(new ErrorProto().setReason("invalid")))));
.setState("FAILED") .setErrorResult( new ErrorProto() .setMessage( String.format( "Job %s failed: %s", job.job.getConfiguration(), e.toString())));