From 318f97f33c23ef29867678b1d6fc780756ffcbde Mon Sep 17 00:00:00 2001 From: joker1007 Date: Tue, 3 Oct 2023 15:06:39 +0900 Subject: [PATCH] fix: fix double casting on `getTimestamp` in order to avoid to abort retrying. Because a timestamp is casted to Instant and retain it on MemoryRecord, but MemoryRecord tries to cast from Timestamp to Instant and raises ClassCastException. And so, retryExecutor abort on the first retry. --- .../src/main/java/org/embulk/output/jdbc/MemoryRecord.java | 2 +- .../src/main/java/org/embulk/output/jdbc/PageReaderRecord.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/MemoryRecord.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/MemoryRecord.java index 92c0dbb7..71196fa9 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/MemoryRecord.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/MemoryRecord.java @@ -41,7 +41,7 @@ public String getString(Column column) public Instant getTimestamp(Column column) { - return ((org.embulk.spi.time.Timestamp) getValue(column)).getInstant(); + return (Instant)getValue(column); } public Value getJson(Column column) diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/PageReaderRecord.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/PageReaderRecord.java index 713211c1..37b4cbf5 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/PageReaderRecord.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/PageReaderRecord.java @@ -22,7 +22,7 @@ public class PageReaderRecord implements Record public PageReaderRecord(PageReader pageReader) { this.pageReader = pageReader; - readRecords = new ArrayList(); + readRecords = new ArrayList<>(); } public void setPage(Page page)