You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/03/16 18:54:00 UTC

[jira] [Work logged] (BEAM-13747) Add integration testing for BQ Storage API write modes

     [ https://issues.apache.org/jira/browse/BEAM-13747?focusedWorklogId=742686&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-742686 ]

ASF GitHub Bot logged work on BEAM-13747:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Mar/22 18:53
            Start Date: 16/Mar/22 18:53
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on a change in pull request #17038:
URL: https://github.com/apache/beam/pull/17038#discussion_r828338310



##########
File path: sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOStorageWriteIT.java
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.bigquery;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.api.services.bigquery.model.QueryResponse;
+import com.google.api.services.bigquery.model.TableFieldSchema;
+import com.google.api.services.bigquery.model.TableRow;
+import com.google.api.services.bigquery.model.TableSchema;
+import com.google.common.collect.ImmutableList;
+import java.io.IOException;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
+import org.apache.beam.sdk.io.GenerateSequence;
+import org.apache.beam.sdk.io.gcp.testing.BigqueryClient;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.SerializableFunction;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Integration tests for {@link
+ * org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO#write(SerializableFunction)}. This test writes
+ * 30MB data to BQ and verify the written row count.
+ */
+@RunWith(JUnit4.class)
+public class BigQueryIOStorageWriteIT {
+
+  private enum WriteMode {
+    EXACT_ONCE,
+    AT_LEAST_ONCE
+  };
+
+  private String project;
+  private static final String DATASET_ID = "big_query_storage";
+  private static final String TABLE_PREFIX = "storage_write_";
+
+  private BigQueryOptions bqOptions;
+  private static final BigqueryClient BQ_CLIENT = new BigqueryClient("BigQueryStorageIOWriteIT");
+
+  private void setUpTestEnvironment(WriteMode writeMode) {
+    PipelineOptionsFactory.register(BigQueryOptions.class);
+    bqOptions = TestPipeline.testingPipelineOptions().as(BigQueryOptions.class);
+    bqOptions.setProject(TestPipeline.testingPipelineOptions().as(GcpOptions.class).getProject());
+    bqOptions.setUseStorageWriteApi(true);
+    if (writeMode == WriteMode.AT_LEAST_ONCE) {
+      bqOptions.setUseStorageWriteApiAtLeastOnce(true);
+    }
+    bqOptions.setNumStorageWriteApiStreams(2);

Review comment:
       I think options "setNumStorageWriteApiStreams" and  "setStorageWriteApiTriggeringFrequencySec" are only intended for unbounded input (in streaming pipelines). @reuvenlax should this have resulted in a validation failure ?




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 742686)
    Remaining Estimate: 0h
            Time Spent: 10m

> Add integration testing for BQ Storage API  write modes
> -------------------------------------------------------
>
>                 Key: BEAM-13747
>                 URL: https://issues.apache.org/jira/browse/BEAM-13747
>             Project: Beam
>          Issue Type: Test
>          Components: io-java-gcp
>            Reporter: Chamikara Madhusanka Jayalath
>            Assignee: Yiru Tang
>            Priority: P1
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We added STORAGE_WRITE_API and STORAGE_API_AT_LEAST_ONCE BQ sink write modes recently [1] but seems like this is not covered by integration testing today.
> This could result in significant breakages that creep into Beam releases (for example, https://github.com/apache/beam/pull/16599).
> These write modes should be regularly integration tested using Jenkins for batch/streaming.
>  
> [1] https://github.com/apache/beam/blob/41d585f82b10195f758d14e3a54076ea1f05aa75/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L1761



--
This message was sent by Atlassian Jira
(v8.20.1#820001)