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

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

                Author: ASF GitHub Bot
            Created on: 24/May/21 14:48
            Start Date: 24/May/21 14:48
    Worklog Time Spent: 10m 
      Work Description: MiguelAnzoWizeline commented on a change in pull 
request #14586:
URL: https://github.com/apache/beam/pull/14586#discussion_r638015299



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/SchemaAndRecord.java
##########
@@ -18,23 +18,32 @@
 package org.apache.beam.sdk.io.gcp.bigquery;
 
 import com.google.api.services.bigquery.model.TableSchema;
+import javax.annotation.Nullable;
 import org.apache.avro.generic.GenericRecord;
+import org.apache.beam.sdk.values.Row;
 
 /**
  * A wrapper for a {@link GenericRecord} and the {@link TableSchema} 
representing the schema of the
  * table (or query) it was generated from.
  */
 public class SchemaAndRecord {
-  private final GenericRecord record;
+  private final Object record;
   private final TableSchema tableSchema;
 
-  public SchemaAndRecord(GenericRecord record, TableSchema tableSchema) {
+  public SchemaAndRecord(Object record, TableSchema tableSchema) {
     this.record = record;
     this.tableSchema = tableSchema;
   }
 
   public GenericRecord getRecord() {
-    return record;
+    if (!(record instanceof GenericRecord)) {
+      throw new IllegalStateException("Object is not GenericRecord");
+    }
+    return (GenericRecord) record;
+  }

Review comment:
       R: @TheNeuralBit It seems that I was mistaken here, there is a lot of 
previous code that still backups the `Object` in `SchemaAndRecord` with an Avro 
`GenericRecord`, would it be better here to find and change those use cases and 
make the conversion to `Row`, or would it be better to leave the `getRecord` 
method to leave that compatibility open and avoid the possibility of breaking 
something?




-- 
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:
[email protected]


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

    Worklog Id:     (was: 601217)
    Time Spent: 42h 10m  (was: 42h)

> BigQuery IO should support reading Arrow format over Storage API
> ----------------------------------------------------------------
>
>                 Key: BEAM-8933
>                 URL: https://issues.apache.org/jira/browse/BEAM-8933
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-gcp
>            Reporter: Kirill Kozlov
>            Assignee: Miguel Anzo
>            Priority: P3
>          Time Spent: 42h 10m
>  Remaining Estimate: 0h
>
> As of right now BigQuery uses Avro format for reading and writing.
> We should add a config to BigQueryIO to specify which format to use: Arrow or 
> Avro (with Avro as default).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to