@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()); } }
@Override public synchronized long getEstimatedSizeBytes(PipelineOptions options) throws Exception { if (tableSizeBytes.get() == null) { TableReference table = setDefaultProjectIfAbsent( options.as(BigQueryOptions.class), BigQueryIO.JSON_FACTORY.fromString(jsonTable.get(), TableReference.class)); Table tableRef = bqServices.getDatasetService(options.as(BigQueryOptions.class)).getTable(table); Long numBytes = tableRef.getNumBytes(); if (tableRef.getStreamingBuffer() != null) { numBytes += tableRef.getStreamingBuffer().getEstimatedBytes().longValue(); } tableSizeBytes.compareAndSet(null, numBytes); } return tableSizeBytes.get(); }
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()); } }
@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(); } }