[
https://issues.apache.org/jira/browse/BEAM-12736?focusedWorklogId=646200&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646200
]
ASF GitHub Bot logged work on BEAM-12736:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Sep/21 07:41
Start Date: 03/Sep/21 07:41
Worklog Time Spent: 10m
Work Description: chrishinds commented on a change in pull request #15306:
URL: https://github.com/apache/beam/pull/15306#discussion_r701668964
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/WriteTables.java
##########
@@ -322,6 +322,36 @@ private JobService getJobService(PipelineOptions
pipelineOptions) throws IOExcep
return jobService;
}
+ @Teardown
+ public void onTeardown() {
+ try {
+ if (datasetService != null) {
+ datasetService.close();
+ datasetService = null;
+ }
+ if (jobService != null) {
+ jobService.close();
+ jobService = null;
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private DatasetService getDatasetService(PipelineOptions pipelineOptions)
throws IOException {
+ if (datasetService == null) {
+ datasetService =
bqServices.getDatasetService(pipelineOptions.as(BigQueryOptions.class));
+ }
+ return datasetService;
+ }
+
+ private JobService getJobService(PipelineOptions pipelineOptions) throws
IOException {
+ if (jobService == null) {
+ jobService =
bqServices.getJobService(pipelineOptions.as(BigQueryOptions.class));
+ }
+ return jobService;
+ }
+
Review comment:
I made this change against the v2.31.0 tag, then had to merge-in HEAD
for Github to allow PR creation. Only once I'd pushed the button did I realise
I'd captured irrelevant commits.
Really, really, sorry. What do you recommend?
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 646200)
Remaining Estimate: 23h 10m (was: 23h 20m)
Time Spent: 50m (was: 40m)
> Protobuf schema provider row functions break on camel-case field names
> ----------------------------------------------------------------------
>
> Key: BEAM-12736
> URL: https://issues.apache.org/jira/browse/BEAM-12736
> Project: Beam
> Issue Type: Bug
> Components: extensions-java-protobuf
> Affects Versions: 2.31.0
> Reporter: Chris Hinds
> Assignee: Chris Hinds
> Priority: P2
> Original Estimate: 24h
> Time Spent: 50m
> Remaining Estimate: 23h 10m
>
> ProtoByteBuddyUtils.protoGetterName() _depends_ on field names being
> snake-case. But the Protobuf style guide only _recommends_ that field names
> are so defined.
> Snake-case is not enforced by protoc and my team have always created proto
> field names in camel-case (perhaps we didn't understand that protoc would
> automatically rewrite field names for us). It is likely that we are not alone.
> If one calls a row function against a proto instance whose field were defined
> in camel-case, an IllegalArgumentException results from the
> ProtoByteBuddyUtils snake-case assumption.
> {code:java}
> SerializableFunction myRowFunction = new
> ProtoMessageSchema().toRowFunction(new
> TypeDescriptor<MyDataModel.ProtoPayload>() {});
> MyDataModel.ProtoPayload payload = …
> Row row = (Row) myRowFunction.apply(payload);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)