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

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

                Author: ASF GitHub Bot
            Created on: 05/Feb/19 21:48
            Start Date: 05/Feb/19 21:48
    Worklog Time Spent: 10m 
      Work Description: kmjung commented on pull request #7441: [BEAM-6392] Add 
support for the BigQuery read API to BigQueryIO.
URL: https://github.com/apache/beam/pull/7441#discussion_r254060105
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryAvroUtils.java
 ##########
 @@ -100,6 +116,62 @@ static String formatTimestamp(String timestamp) {
     return String.format("%s.%s UTC", dayAndTime, fractionalSeconds);
   }
 
+  /**
+   * This method formats a BigQuery DATE value into a String matching the 
format used by JSON
+   * export. Date records are stored in "days since epoch" format, and 
BigQuery uses the proleptic
+   * Gregorian calendar.
+   */
+  private static String formatDate(int date) {
+    return 
LocalDate.ofEpochDay(date).format(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE);
+  }
+
+  private static final java.time.format.DateTimeFormatter 
ISO_LOCAL_TIME_FORMATTER_MICROS =
+      new DateTimeFormatterBuilder()
+          .appendValue(HOUR_OF_DAY, 2)
+          .appendLiteral(':')
+          .appendValue(MINUTE_OF_HOUR, 2)
+          .appendLiteral(':')
+          .appendValue(SECOND_OF_MINUTE, 2)
+          .appendLiteral('.')
+          .appendFraction(NANO_OF_SECOND, 6, 6, false)
+          .toFormatter();
+
+  private static final java.time.format.DateTimeFormatter 
ISO_LOCAL_TIME_FORMATTER_MILLIS =
+      new DateTimeFormatterBuilder()
+          .appendValue(HOUR_OF_DAY, 2)
+          .appendLiteral(':')
+          .appendValue(MINUTE_OF_HOUR, 2)
+          .appendLiteral(':')
+          .appendValue(SECOND_OF_MINUTE, 2)
+          .appendLiteral('.')
+          .appendFraction(NANO_OF_SECOND, 3, 3, false)
+          .toFormatter();
+
+  private static final java.time.format.DateTimeFormatter 
ISO_LOCAL_TIME_FORMATTER_SECONDS =
+      new DateTimeFormatterBuilder()
+          .appendValue(HOUR_OF_DAY, 2)
+          .appendLiteral(':')
+          .appendValue(MINUTE_OF_HOUR, 2)
+          .appendLiteral(':')
+          .appendValue(SECOND_OF_MINUTE, 2)
+          .toFormatter();
+
+  /**
+   * This method formats a BigQuery TIME value into a String matching the 
format used by JSON
+   * export. Time records are stored in "microseconds since midnight" format.
+   */
+  private static String formatTime(long timeMicros) {
 
 Review comment:
   This is necessary in order to match exactly the string format used by 
BigQuery export, which always uses the least-precise format if a value can be 
converted without loss of precision. It's likely that the approach you propose 
would not lead to correctness issues for pipelines; the integration test I've 
added wouldn't pass, though. :-)
 
----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 194829)
    Time Spent: 1h 40m  (was: 1.5h)

> Add support for new BigQuery streaming read API to BigQueryIO
> -------------------------------------------------------------
>
>                 Key: BEAM-6392
>                 URL: https://issues.apache.org/jira/browse/BEAM-6392
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-java-gcp
>            Reporter: Kenneth Jung
>            Assignee: Kenneth Jung
>            Priority: Major
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> BigQuery has developed a new streaming egress API which will soon reach 
> public availability. Add support for the new API in BigQueryIO.



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

Reply via email to