private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { super(statisticsPb); if (statisticsPb.getExtract() != null) { this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts(); } }
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { super(statisticsPb); if (statisticsPb.getExtract() != null) { this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts(); } }
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { super(statisticsPb); this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts(); }
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { super(statisticsPb); this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts(); }
static List<ResourceId> getExtractFilePaths(String extractDestinationDir, Job extractJob) throws IOException { JobStatistics jobStats = extractJob.getStatistics(); List<Long> counts = jobStats.getExtract().getDestinationUriFileCounts(); if (counts.size() != 1) { String errorMessage = (counts.isEmpty() ? "No destination uri file count received." : String.format( "More than one destination uri file count received. First two are %s, %s", counts.get(0), counts.get(1))); throw new RuntimeException(errorMessage); } long filesCount = counts.get(0); ImmutableList.Builder<ResourceId> paths = ImmutableList.builder(); ResourceId extractDestinationDirResourceId = FileSystems.matchNewResource(extractDestinationDir, true /* isDirectory */); for (long i = 0; i < filesCount; ++i) { ResourceId filePath = extractDestinationDirResourceId.resolve( String.format("%012d%s", i, ".avro"), ResolveOptions.StandardResolveOptions.RESOLVE_FILE); paths.add(filePath); } return paths.build(); }
@SuppressWarnings("unchecked") static <T extends JobStatistics> T fromPb( com.google.api.services.bigquery.model.JobStatistics statisticPb) { if (statisticPb.getLoad() != null) { return (T) LoadStatistics.fromPb(statisticPb); } else if (statisticPb.getExtract() != null) { return (T) ExtractStatistics.fromPb(statisticPb); } else if (statisticPb.getQuery() != null) { return (T) QueryStatistics.fromPb(statisticPb); } else { return (T) CopyStatistics.fromPb(statisticPb); } } }
@SuppressWarnings("unchecked") static <T extends JobStatistics> T fromPb( com.google.api.services.bigquery.model.JobStatistics statisticPb) { if (statisticPb.getLoad() != null) { return (T) LoadStatistics.fromPb(statisticPb); } else if (statisticPb.getExtract() != null) { return (T) ExtractStatistics.fromPb(statisticPb); } else if (statisticPb.getQuery() != null) { return (T) QueryStatistics.fromPb(statisticPb); } else { return (T) new Builder(statisticPb).build(); } } }