You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 22:39:53 UTC

[GitHub] [beam] damccorm opened a new issue, #21321: BigQueryIO.write() never emits successfully written records

damccorm opened a new issue, #21321:
URL: https://github.com/apache/beam/issues/21321

   In the following code snippet the data gets successfully inserted into BigQuery. But the "getSuccessfulInserts" Transform never returns any data. No log is written.
   ```
   
   WriteResult writeResultCategory =
               categoryWithHeader
                       .apply("BQ Insert
   Category",
                               BigQueryIO.<CategoryWithHeader>write()
                      
                   .withCreateDisposition(CreateDisposition.CREATE_IF_NEEDED)
                          
               .withWriteDisposition(WriteDisposition.WRITE_APPEND)
                                    
     .withMethod(BigQueryIO.Write.Method.STREAMING_INSERTS)
                                       .withExtendedErrorInfo()
   
                                      .withFailedInsertRetryPolicy(InsertRetryPolicy.neverRetry())
     
                                    .useBeamSchema()
                                       .to(getTableReference(tableCategory))
   
                      );
   
   
    writeResultCategory
               .getSuccessfulInserts()
               .apply("Log
   successful inserts", ParDo.of(new DoFn<TableRow, Void>() {
                   @ProcessElement
         
            public void process(ProcessContext c) {
                       LOG.info("Successfully inserted
   Category: " + c.element());
                   }
               })); 
   ```
   
   The problematic code might be in
   ```
   
   org.apache.beam.sdk.io.gcp.bigquery.BatchedStreamingWrite.BatchAndInsertElements#finishBundle
   ```
   
   The successfulInserts are never emitted from here.
   
   Please compare this behaviour with the following method where the successfulInserts are emitted:
   ```
   
   org.apache.beam.sdk.io.gcp.bigquery.BatchedStreamingWrite.InsertBatchedElements#processElement
   ```
   
    
   
   Imported from Jira [BEAM-13464](https://issues.apache.org/jira/browse/BEAM-13464). Original Jira may contain additional context.
   Reported by: thokie.


-- 
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.apache.org

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