Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-7999

BigQueryIO.readTableRowsWithSchema() doesn't handle timestamp correctly

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • 2.14.0, 2.15.0
    • 2.16.0
    • io-java-gcp
    • None

    Description

      Using the new readTableRowsWithSchema to make a copy of a table (simple operation), parsing the timestamp in the table doesn't work as it assumes a Double value. BigQuery outputs a string like "2019-08-16 00:12:00.123456 UTC". This isn't handled.

      Reproducable:

      with this table

      INSERT `research.alex.in1` (row_id, f_int64, f_timestamp)
      VALUES
          (1, 1, '2019-08-16 00:12:00 UTC'),
          (2, 2, '2019-08-16 00:12:00.123 UTC'),
          (3, 3, '2019-08-16 00:12:00.123456 UTC')
      

      do a copy operation:

      pipeline
              .apply(
                      BigQueryIO.readTableRowsWithSchema()
                              .from("research:alex.in1")
                      //.withMethod(BigQueryIO.TypedRead.Method.DIRECT_READ)
      
              )
              .apply(ParDo.of(new Inspect()))
              .apply(
                      BigQueryIO.writeTableRows()
                              .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED)
                              .withMethod(BigQueryIO.Write.Method.FILE_LOADS)
                              .useBeamSchema()
                              .to("research:alex.out4"));
      

       

      Attachments

        Activity

          People

            alexvanboxel Alex Van Boxel
            alexvanboxel Alex Van Boxel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 10m
                1h 10m