liu-du commented on a change in pull request #16926:
URL: https://github.com/apache/beam/pull/16926#discussion_r814325014
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiDynamicDestinationsTableRow.java
##########
@@ -23,24 +23,18 @@
import com.google.api.services.bigquery.model.TableSchema;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Message;
-import java.time.Duration;
+import java.io.IOException;
import javax.annotation.Nullable;
import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.Write.CreateDisposition;
import org.apache.beam.sdk.io.gcp.bigquery.BigQueryServices.DatasetService;
import org.apache.beam.sdk.transforms.SerializableFunction;
-import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.cache.Cache;
-import
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.cache.CacheBuilder;
@SuppressWarnings({"nullness"})
public class StorageApiDynamicDestinationsTableRow<T, DestinationT>
extends StorageApiDynamicDestinations<T, DestinationT> {
private final SerializableFunction<T, TableRow> formatFunction;
private final CreateDisposition createDisposition;
- // TODO: Is this cache needed? All callers of getMessageConverter are
already caching the resullt.
- private final Cache<DestinationT, Descriptor> destinationDescriptorCache =
-
CacheBuilder.newBuilder().expireAfterAccess(Duration.ofMinutes(15)).build();
Review comment:
I agree with the TODO comment that the cache is not needed here. The
MessageConverter return by getMessageConverter also need to remember the
equivalent TableSchema, but this cache only saves Descriptor, so I removed it
entirely
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]