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

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

                Author: ASF GitHub Bot
            Created on: 27/Jun/18 22:57
            Start Date: 27/Jun/18 22:57
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on a change in pull request #5792: 
[BEAM-4646][SQL] Improve BigQuery write integration test
URL: https://github.com/apache/beam/pull/5792#discussion_r198665683
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java
 ##########
 @@ -172,18 +175,26 @@ public static TableRow toTableRow(Row row) {
       Field schemaField = row.getSchema().getField(i);
       TypeName type = schemaField.getType().getTypeName();
 
-      if (TypeName.ARRAY == type) {
-        type = schemaField.getType().getCollectionElementType().getTypeName();
-        if (TypeName.ROW == type) {
-          List<Row> rows = (List<Row>) value;
-          List<TableRow> tableRows = new ArrayList<TableRow>(rows.size());
-          for (int j = 0; j < rows.size(); j++) {
-            tableRows.add(toTableRow(rows.get(j)));
+      switch (type) {
+        case ARRAY:
+          type = 
schemaField.getType().getCollectionElementType().getTypeName();
+          if (TypeName.ROW == type) {
+            List<Row> rows = (List<Row>) value;
+            List<TableRow> tableRows = new ArrayList<TableRow>(rows.size());
+            for (int j = 0; j < rows.size(); j++) {
+              tableRows.add(toTableRow(rows.get(j)));
+            }
+            value = tableRows;
           }
-          value = tableRows;
-        }
-      } else if (TypeName.ROW == type) {
-        value = toTableRow((Row) value);
+          break;
+        case ROW:
+          value = toTableRow((Row) value);
+          break;
+        case DATETIME:
+          value = ((Instant) value).toString();
+          break;
+        default:
+          break;
 
 Review comment:
   That set can be copied to here but not move, because line 182 needs the 
value assigned.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 116647)
    Time Spent: 2h  (was: 1h 50m)

> Improve SQL's BigQuery write integration test
> ---------------------------------------------
>
>                 Key: BEAM-4646
>                 URL: https://issues.apache.org/jira/browse/BEAM-4646
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Right now SQL's BigQuery write integration test only tests VARCHAR, ARRAY and 
>  BIGINT, it might be better to test other SQL types which Beam SQL/Calcite is 
> supporting.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to