/** * Deletes the temporary dataset, including all of the work tables. * * @param context the job's context. * @throws IOException */ @Override public void cleanupJob(JobContext context) throws IOException { logger.atFine().log("cleanupJob(%s)", lazy(() -> HadoopToStringUtil.toString(context))); Bigquery.Datasets datasets = bigQueryHelper.getRawBigquery().datasets(); try { logger.atFine().log( "cleanupJob: Deleting dataset '%s' from project '%s'", tempTableRef.getDatasetId(), tempTableRef.getProjectId()); datasets.delete(tempTableRef.getProjectId(), tempTableRef.getDatasetId()) .setDeleteContents(true) .execute(); } catch (IOException e) { // Error is swallowed as job has completed successfully and the only failure is deleting // temporary data. // This matches the FileOutputCommitter pattern. logger.atWarning().withCause(e).log( "Could not delete dataset. Temporary data not cleaned up."); } }
@Override public boolean deleteDataset(String datasetId, Map<Option, ?> options) { try { bigquery.datasets().delete(this.options.projectId(), datasetId) .setDeleteContents(DELETE_CONTENTS.getBoolean(options)) .execute(); return true; } catch (IOException ex) { BigQueryException serviceException = translate(ex); if (serviceException.code() == HTTP_NOT_FOUND) { return false; } throw serviceException; } }
@Override public boolean deleteDataset(String datasetId, Map<Option, ?> options) { try { bigquery.datasets().delete(this.options.projectId(), datasetId) .setDeleteContents(DELETE_CONTENTS.getBoolean(options)) .execute(); return true; } catch (IOException ex) { BigQueryException serviceException = translate(ex); if (serviceException.code() == HTTP_NOT_FOUND) { return false; } throw serviceException; } }
@Override public boolean deleteDataset(String projectId, String datasetId, Map<Option, ?> options) { try { bigquery .datasets() .delete(projectId, datasetId) .setDeleteContents(Option.DELETE_CONTENTS.getBoolean(options)) .execute(); return true; } catch (IOException ex) { BigQueryException serviceException = translate(ex); if (serviceException.getCode() == HTTP_NOT_FOUND) { return false; } throw serviceException; } }
@Override public boolean deleteDataset(String projectId, String datasetId, Map<Option, ?> options) { try { bigquery .datasets() .delete(projectId, datasetId) .setDeleteContents(Option.DELETE_CONTENTS.getBoolean(options)) .execute(); return true; } catch (IOException ex) { BigQueryException serviceException = translate(ex); if (serviceException.getCode() == HTTP_NOT_FOUND) { return false; } throw serviceException; } }