Skip to content

Commit

Permalink
Merge pull request #248 from embulk/rebuild-TaskReport-from-core-Task…
Browse files Browse the repository at this point in the history
…Report

Rebuild TaskReport with this plugin's Jackson before getting "last_record"
  • Loading branch information
dmikurube authored Nov 22, 2022
2 parents 4152802 + fc809f5 commit 92886a6
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ subprojects {
compileOnly "org.embulk:embulk-api:0.10.36"
compileOnly "org.embulk:embulk-spi:0.10.36"

compile("org.embulk:embulk-util-config:0.3.1") {
compile("org.embulk:embulk-util-config:0.3.2") {
// They conflict with embulk-core. They are once excluded here,
// and added explicitly with versions exactly the same with older embulk-core (until v0.10.31).
exclude group: "com.fasterxml.jackson.core", module: "jackson-annotations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-api:0.10.36
org.embulk:embulk-spi:0.10.36
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ com.fasterxml.jackson.core:jackson-core:2.6.7
com.fasterxml.jackson.core:jackson-databind:2.6.7
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-timestamp:0.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.embulk.config.ConfigException;
import org.embulk.config.ConfigDiff;
import org.embulk.config.ConfigSource;
import org.embulk.config.DataSource;
import org.embulk.config.TaskReport;
import org.embulk.config.TaskSource;
import org.embulk.spi.BufferAllocator;
Expand Down Expand Up @@ -426,17 +425,10 @@ protected ConfigDiff buildNextConfigDiff(PluginTask task, List<TaskReport> repor
{
final ConfigDiff next = CONFIG_MAPPER_FACTORY.newConfigDiff();
if (reports.size() > 0 && reports.get(0).has("last_record")) {
final List<?> lastRecords = reports.get(0).get(List.class, "last_record");
for (final Object item : lastRecords) {
if (item instanceof DataSource) { // Embulk's common DataSource.
logger.info("last_record consists of DataSource: {}", item.getClass().getName());
} else if (item instanceof JsonNode) { // This plugin's Jackson.
logger.info("last_record consists of (plugin's) JsonNode: {}", item.getClass().getName());
} else { // Core's Jackson...?
logger.info("last_record consists of: {}", item.getClass().getName());
}
}
next.set("last_record", lastRecords);
// |reports| are from embulk-core, then their backend is Jackson on the embulk-core side.
// To render |JsonNode| (that is on the plugin side) from |reports|, they need to be rebuilt.
final TaskReport report = CONFIG_MAPPER_FACTORY.rebuildTaskReport(reports.get(0));
next.set("last_record", report.get(JsonNode.class, "last_record"));
} else if (task.getLastRecord().isPresent()) {
next.set("last_record", task.getLastRecord().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ javax.validation:validation-api:1.1.0.Final
mysql:mysql-connector-java:5.1.44
org.embulk:embulk-api:0.10.36
org.embulk:embulk-spi:0.10.36
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ com.fasterxml.jackson.core:jackson-core:2.6.7
com.fasterxml.jackson.core:jackson-databind:2.6.7
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-timestamp:0.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-api:0.10.36
org.embulk:embulk-spi:0.10.36
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ com.fasterxml.jackson.core:jackson-core:2.6.7
com.fasterxml.jackson.core:jackson-databind:2.6.7
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-timestamp:0.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-api:0.10.36
org.embulk:embulk-spi:0.10.36
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ com.fasterxml.jackson.core:jackson-core:2.6.7
com.fasterxml.jackson.core:jackson-databind:2.6.7
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
javax.validation:validation-api:1.1.0.Final
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-timestamp:0.2.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ net.sourceforge.jtds:jtds:1.3.1
org.apache.commons:commons-lang3:3.4
org.embulk:embulk-api:0.10.36
org.embulk:embulk-spi:0.10.36
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ net.minidev:accessors-smart:2.4.2
net.minidev:json-smart:2.4.2
net.sourceforge.jtds:jtds:1.3.1
org.apache.commons:commons-lang3:3.4
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-timestamp:0.2.1
Expand Down

0 comments on commit 92886a6

Please sign in to comment.