@SuppressWarnings("unchecked") static ModelTableDefinition fromPb(Table tablePb) { Builder builder = newBuilder().table(tablePb); return builder.setNumBytes(tablePb.getNumBytes()).setLocation(tablePb.getLocation()).build(); } }
@SuppressWarnings("unchecked") static StandardTableDefinition fromPb(Table tablePb) { Builder builder = newBuilder().table(tablePb); if (tablePb.getNumRows() != null) { builder.setNumRows(tablePb.getNumRows().longValue()); } if (tablePb.getStreamingBuffer() != null) { builder.setStreamingBuffer(StreamingBuffer.fromPb(tablePb.getStreamingBuffer())); } if (tablePb.getTimePartitioning() != null) { builder.setTimePartitioning(TimePartitioning.fromPb(tablePb.getTimePartitioning())); } if (tablePb.getClustering() != null) { builder.setClustering(Clustering.fromPb(tablePb.getClustering())); } return builder.setNumBytes(tablePb.getNumBytes()).setLocation(tablePb.getLocation()).build(); } }
private Builder(Table tablePb) { super(tablePb); if (tablePb.getNumRows() != null) { this.numRows(tablePb.getNumRows().longValue()); } this.numBytes = tablePb.getNumBytes(); this.location = tablePb.getLocation(); if (tablePb.getStreamingBuffer() != null) { this.streamingBuffer = StreamingBuffer.fromPb(tablePb.getStreamingBuffer()); } }
@SuppressWarnings("unchecked") static ModelTableDefinition fromPb(Table tablePb) { Builder builder = newBuilder().table(tablePb); return builder.setNumBytes(tablePb.getNumBytes()).setLocation(tablePb.getLocation()).build(); } }
private Builder(Table tablePb) { super(tablePb); if (tablePb.getNumRows() != null) { this.numRows(tablePb.getNumRows().longValue()); } this.numBytes = tablePb.getNumBytes(); this.location = tablePb.getLocation(); if (tablePb.getStreamingBuffer() != null) { this.streamingBuffer = StreamingBuffer.fromPb(tablePb.getStreamingBuffer()); } if (tablePb.getTimePartitioning() != null) { this.timePartitioning = TimePartitioning.fromPb(tablePb.getTimePartitioning()); } }
if (tables != null && !tables.isEmpty()) { Table table = getTable(tables.get(0)); location = table.getLocation();
if (referencedTables != null && !referencedTables.isEmpty()) { TableReference queryTable = referencedTables.get(0); location = tableService.getTable(queryTable).getLocation();
createJobReference(projectId, "direct-bigqueryhelper-export", table.getLocation());
@Override public void beginExport() throws IOException { // Create job and configuration. JobConfigurationExtract extractConfig = new JobConfigurationExtract(); // Set source. extractConfig.setSourceTable(tableToExport.getTableReference()); // Set destination. extractConfig.setDestinationUris(getExportPaths()); extractConfig.set(DESTINATION_FORMAT_KEY, fileFormat.getFormatIdentifier()); JobConfiguration config = new JobConfiguration(); config.setExtract(extractConfig); JobReference jobReference = bigQueryHelper.createJobReference( projectId, "exporttocloudstorage", tableToExport.getLocation()); Job job = new Job(); job.setConfiguration(config); job.setJobReference(jobReference); // Insert and run job. try { Job response = bigQueryHelper.insertJobOrFetchDuplicate(projectId, job); logger.atFine().log("Got response '%s'", response); exportJobReference = response.getJobReference(); } catch (IOException e) { String error = String.format( "Error while exporting table %s", BigQueryStrings.toString(tableToExport.getTableReference())); throw new IOException(error, e); } }
@SuppressWarnings("unchecked") static StandardTableDefinition fromPb(Table tablePb) { Builder builder = newBuilder().table(tablePb); if (tablePb.getNumRows() != null) { builder.setNumRows(tablePb.getNumRows().longValue()); } if (tablePb.getStreamingBuffer() != null) { builder.setStreamingBuffer(StreamingBuffer.fromPb(tablePb.getStreamingBuffer())); } if (tablePb.getTimePartitioning() != null) { builder.setTimePartitioning(TimePartitioning.fromPb(tablePb.getTimePartitioning())); } if (tablePb.getClustering() != null) { builder.setClustering(Clustering.fromPb(tablePb.getClustering())); } return builder.setNumBytes(tablePb.getNumBytes()).setLocation(tablePb.getLocation()).build(); } }
bigQueryHelper.createJobReference(projectId, "querybasedexport", table.getLocation());