You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/09 18:53:30 UTC

[GitHub] [beam] kennknowles commented on a change in pull request #11003: [BEAM-9411] Enable BigQuery DIRECT_READ by default in SQL

kennknowles commented on a change in pull request #11003: [BEAM-9411] Enable BigQuery DIRECT_READ by default in SQL
URL: https://github.com/apache/beam/pull/11003#discussion_r389893825
 
 

 ##########
 File path: sdks/java/extensions/sql/datacatalog/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogBigQueryIT.java
 ##########
 @@ -69,9 +73,18 @@
 
     @Test
     public void testRead() throws Exception {
-      bigQuery.insertRows(ID_NAME_SCHEMA, row(1, "name1"), row(2, "name2"), row(3, "name3"));
-
       TableReference bqTable = bigQuery.tableReference();
+
+      // Streaming inserts do not work with DIRECT_READ mode, there is a several hour lag.
+      PCollection<Row> data =
+          writePipeline.apply(Create.of(row(1, "name1"), row(2, "name2"), row(3, "name3")));
+      data.apply(
+          BigQueryIO.<Row>write()
+              .withSchema(BigQueryUtils.toTableSchema(ID_NAME_SCHEMA))
+              .withFormatFunction(BigQueryUtils.toTableRow())
 
 Review comment:
   I would suggest to add `.withMethod(Method.FILE_LOADS)` to be explicit. It connects it better with the comment above. And is protected in case the default changes.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services