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

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

                Author: ASF GitHub Bot
            Created on: 12/Aug/19 14:45
            Start Date: 12/Aug/19 14:45
    Worklog Time Spent: 10m 
      Work Description: lgajowy commented on pull request #9295: [BEAM-7721] 
Add write test to BigQueryIOIT
URL: https://github.com/apache/beam/pull/9295#discussion_r312961617
 
 

 ##########
 File path: 
sdks/java/io/bigquery-io-tests/src/test/java/org/apache/beam/sdk/bigqueryiotests/BigQueryIOIT.java
 ##########
 @@ -151,46 +159,51 @@ private static void createAndFillSourceTable() {
                       return tableRow;
                     })
                 
.withCustomGcsTempLocation(ValueProvider.StaticValueProvider.of(tempRoot))
+                .withMethod(method)
                 .withSchema(
                     new TableSchema()
                         .setFields(
                             Collections.singletonList(
                                 new 
TableFieldSchema().setName("data").setType("BYTES")))));
-    pipeline.run().waitUntilFinish();
+
+    PipelineResult pipelineResult = pipeline.run();
+    pipelineResult.waitUntilFinish();
+    extractAndPublishTime(pipelineResult, WRITE_TIME_METRIC_NAME);
   }
 
-  private static boolean checkForSourceTable() {
-    BigQueryOptions options = BigQueryOptions.newBuilder().build();
-    BigQuery client = options.getService();
-    TableId tableId =
-        TableId.of(options.getProjectId(), bigQuerySourceDataset, 
bigQuerySourceTable);
-    Table sourceTable = client.getTable(tableId, 
TableOption.fields(BigQuery.TableField.TYPE));
-    return sourceTable != null;
+  private void extractAndPublishTime(PipelineResult pipelineResult, String 
writeTimeMetricName) {
+    NamedTestResult metricResult =
+        getMetricSupplier(writeTimeMetricName).apply(new 
MetricsReader(pipelineResult, NAMESPACE));
+    IOITMetrics.publish(
+        TEST_ID,
+        TEST_TIMESTAMP,
+        bigQueryMetricsDataset,
+        bigQueryMetricsTable,
+        Collections.singletonList(metricResult));
   }
 
   @Test
-  public void testRead() {
+  public void testWriteThenRead() {
 
 Review comment:
   This method should be above all private methods that are used in this public 
method (java convention)
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

    Worklog Id:     (was: 293183)
    Time Spent: 7.5h  (was: 7h 20m)

> Measure throughput in BigQueryIO read in Java
> ---------------------------------------------
>
>                 Key: BEAM-7721
>                 URL: https://issues.apache.org/jira/browse/BEAM-7721
>             Project: Beam
>          Issue Type: Improvement
>          Components: testing
>            Reporter: Michal Walenia
>            Assignee: Michal Walenia
>            Priority: Major
>          Time Spent: 7.5h
>  Remaining Estimate: 0h
>
> Collect bytes/time metric in BQ read tests in Java SDK



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to