Skip to content

Commit a41fc2a

Browse files
committed
fix instant time
1 parent 6cf7ceb commit a41fc2a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

v2/bigquery-to-parquet/src/test/java/com/google/cloud/teleport/v2/templates/BigQueryToParquetIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ public void testTimePartitionedBigQueryTableToParquet() throws IOException {
164164

165165
// prep expected dataset used for assertion, we expect timestamps that satisfy ROW_RESTRICTION
166166
if (expectedTimestamps.contains(timestampString)) {
167-
// Convert to Epoch since timestamps stored in Parquet files are in Epoch
167+
// With AVRO >= 1.12.0 and parquet-avro, timestamps are read as java.time.Instant
168+
// and formatted as ISO-8601 strings in the assertions.
168169
Instant instant = Instant.parse(timestampString);
169-
long epochMillis = instant.getEpochSecond() * 1_000_000 + instant.getNano() / 1_000;
170170
Map<String, Object> expectedContent = new HashMap<>(generatedRow.getContent());
171-
expectedContent.put(PARTITION_FIELD, epochMillis);
171+
expectedContent.put(PARTITION_FIELD, instant.toString());
172172
expectedBigQueryRows.add(RowToInsert.of(expectedContent));
173173
}
174174
}

0 commit comments

Comments
 (0)