embulk-filter-copy 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +5 -1
- data/build.gradle +6 -5
- data/example/config.yml +1 -0
- data/example/data.tsv +5 -5
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +1 -2
- data/gradlew +13 -10
- data/src/main/java/org/embulk/filter/copy/CopyFilterPlugin.java +26 -37
- data/src/main/java/org/embulk/filter/copy/forward/{ForwardBaseTask.java → ForwardParentTask.java} +1 -1
- data/src/main/java/org/embulk/filter/copy/forward/InForwardEventReader.java +67 -62
- data/src/main/java/org/embulk/filter/copy/forward/InForwardService.java +102 -35
- data/src/main/java/org/embulk/filter/copy/forward/OutForwardEventBuilder.java +66 -54
- data/src/main/java/org/embulk/filter/copy/forward/OutForwardService.java +2 -2
- data/src/main/java/org/embulk/filter/copy/plugin/InternalForwardInputPlugin.java +11 -13
- data/src/main/java/org/embulk/filter/copy/runner/AsyncEmbulkRunnerService.java +32 -0
- data/src/main/java/org/embulk/filter/copy/runner/EmbulkRunner.java +124 -0
- data/src/main/java/org/embulk/filter/copy/spi/DataBuilder.java +41 -0
- data/src/main/java/org/embulk/filter/copy/spi/DataReader.java +41 -0
- data/src/main/java/org/embulk/filter/copy/spi/ElapsedTime.java +81 -0
- data/src/main/java/org/embulk/filter/copy/spi/PageBuilder.java +16 -0
- data/src/main/java/org/embulk/filter/copy/spi/PageReader.java +13 -0
- data/src/main/java/org/embulk/filter/copy/{util → spi}/StandardColumnVisitor.java +6 -6
- data/src/test/java/org/embulk/filter/copy/TestCopyFilterPlugin.java +0 -11
- metadata +24 -16
- data/src/main/java/org/embulk/filter/copy/executor/EmbulkExecutor.java +0 -105
- data/src/main/java/org/embulk/filter/copy/executor/LocalThreadExecutor.java +0 -96
- data/src/main/java/org/embulk/filter/copy/forward/InForwardVisitor.java +0 -63
- data/src/main/java/org/embulk/filter/copy/forward/OutForwardVisitor.java +0 -63
- data/src/main/java/org/embulk/filter/copy/util/ElapsedTime.java +0 -165
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c71648337b5b1edcc9bee9e7839dcaca696cfe2
|
4
|
+
data.tar.gz: 59fd5e9cf1092a9880552074a0e9e404d4fba62c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b35ef1db23ce24ffa0c76d82455f3053e57db6c629490880c0e7ec4c33fcb3b906412030cc4974f938522c474aec0a8e29f8b1d085326a455f2da032ec7fc34
|
7
|
+
data.tar.gz: f4dac991cee674b2a71e92539f3d90ca4719a6570e4e10c2fc30d1cf19aadef0a098c2841e9f457cdc23882cf8a1837c1191ac736480ff1153d5d6f86368c74b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
0.1.0 (2019-09-26)
|
2
|
+
==================
|
3
|
+
* Follow embulk v0.9.x interfaces.
|
4
|
+
* Packing as MessagePack become faster because, when parsing or formatting `Timestamp` values, use only `epochSecond` and `nanoAdjustment` instead of `TimestampFormatter` and `TimestampParser`.
|
5
|
+
|
1
6
|
0.0.2 (2017-07-01)
|
2
7
|
==================
|
3
8
|
* Write a default values test.
|
@@ -5,4 +10,4 @@
|
|
5
10
|
|
6
11
|
0.0.1 (2017-06-07)
|
7
12
|
==================
|
8
|
-
* first release.
|
13
|
+
* first release.
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Copy records and run another embulk by using them as input data source.
|
4
4
|
|
5
|
+
The Document for Japanese is [here](http://qiita.com/Civitaspo/items/da8483c28817071d90dc).
|
6
|
+
|
5
7
|
## Overview
|
6
8
|
|
7
9
|
* **Plugin type**: filter
|
@@ -53,7 +55,9 @@ $ embulk run example/config.yml -Ilib
|
|
53
55
|
|
54
56
|
### Run test:
|
55
57
|
|
56
|
-
|
58
|
+
```shell
|
59
|
+
$ ./gradlew test
|
60
|
+
```
|
57
61
|
|
58
62
|
### Release gem:
|
59
63
|
Fix [build.gradle](./build.gradle), then
|
data/build.gradle
CHANGED
@@ -14,22 +14,23 @@ configurations {
|
|
14
14
|
provided
|
15
15
|
}
|
16
16
|
|
17
|
-
version = "0.0
|
17
|
+
version = "0.1.0"
|
18
18
|
|
19
19
|
sourceCompatibility = 1.8
|
20
20
|
targetCompatibility = 1.8
|
21
21
|
|
22
22
|
dependencies {
|
23
|
-
compile "org.embulk:embulk-core:0.
|
24
|
-
provided "org.embulk:embulk-core:0.
|
25
|
-
compile
|
23
|
+
compile "org.embulk:embulk-core:0.9.18"
|
24
|
+
provided "org.embulk:embulk-core:0.9.18"
|
25
|
+
compile 'com.google.guava:guava:23.0'
|
26
26
|
// The latest version of fluency is 1.3.0, but
|
27
27
|
// This plugin use 1.1.0 for using the same msgpack version as embulk.
|
28
28
|
// ref. https://github.com/komamitsu/fluency/compare/1.1.0...1.3.0
|
29
29
|
compile "org.komamitsu:fluency:1.1.0"
|
30
|
+
compile 'com.okumin:influent-java:0.3.0'
|
30
31
|
|
31
32
|
testCompile "junit:junit:4.+"
|
32
|
-
testCompile "org.embulk:embulk-core:0.
|
33
|
+
testCompile "org.embulk:embulk-core:0.9.18:tests"
|
33
34
|
}
|
34
35
|
|
35
36
|
task classpath(type: Copy, dependsOn: ["jar"]) {
|
data/example/config.yml
CHANGED
data/example/data.tsv
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
0 c20ef94602 c212c89f91 {"a":0,"b":"99"}
|
2
|
-
1 330a9fc33a e25b33b616 {"a":1,"b":"a9"}
|
3
|
-
2 707b3b7588 90823c6a1f {"a":2,"b":"96"}
|
4
|
-
3 8d8288e66f {"a":3,"b":"86"}
|
5
|
-
4 c54d8b6481 e56a40571c {"a":4,"b":"d2"}
|
1
|
+
0 c20ef94602 c212c89f91 2017-10-24 03:54:35 +0900 {"a":0,"b":"99"}
|
2
|
+
1 330a9fc33a e25b33b616 2017-10-22 19:53:31 +0900 {"a":1,"b":"a9"}
|
3
|
+
2 707b3b7588 90823c6a1f 2017-10-23 23:42:43 +0900 {"a":2,"b":"96"}
|
4
|
+
3 8d8288e66f 2017-10-22 06:12:13 +0900 {"a":3,"b":"86"}
|
5
|
+
4 c54d8b6481 e56a40571c 2017-10-23 04:59:16 +0900 {"a":4,"b":"d2"}
|
Binary file
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#Sun Jan 08 00:35:58 PST 2017
|
2
1
|
distributionBase=GRADLE_USER_HOME
|
3
2
|
distributionPath=wrapper/dists
|
4
3
|
zipStoreBase=GRADLE_USER_HOME
|
5
4
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
5
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
|
data/gradlew
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env sh
|
2
2
|
|
3
3
|
##############################################################################
|
4
4
|
##
|
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
|
|
33
33
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
34
34
|
MAX_FD="maximum"
|
35
35
|
|
36
|
-
warn (
|
36
|
+
warn () {
|
37
37
|
echo "$*"
|
38
38
|
}
|
39
39
|
|
40
|
-
die (
|
40
|
+
die () {
|
41
41
|
echo
|
42
42
|
echo "$*"
|
43
43
|
echo
|
@@ -154,16 +154,19 @@ if $cygwin ; then
|
|
154
154
|
esac
|
155
155
|
fi
|
156
156
|
|
157
|
-
#
|
158
|
-
|
159
|
-
|
157
|
+
# Escape application args
|
158
|
+
save () {
|
159
|
+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
160
|
+
echo " "
|
160
161
|
}
|
161
|
-
|
162
|
-
|
162
|
+
APP_ARGS=$(save "$@")
|
163
|
+
|
164
|
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
165
|
+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
163
166
|
|
164
167
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
165
|
-
if [
|
168
|
+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
166
169
|
cd "$(dirname "$0")"
|
167
170
|
fi
|
168
171
|
|
169
|
-
exec "$JAVACMD" "
|
172
|
+
exec "$JAVACMD" "$@"
|
@@ -5,21 +5,21 @@ import org.embulk.config.ConfigDefault;
|
|
5
5
|
import org.embulk.config.ConfigSource;
|
6
6
|
import org.embulk.config.Task;
|
7
7
|
import org.embulk.config.TaskSource;
|
8
|
-
import org.embulk.filter.copy.executor.EmbulkExecutor;
|
9
8
|
import org.embulk.filter.copy.forward.InForwardService;
|
10
9
|
import org.embulk.filter.copy.forward.OutForwardEventBuilder;
|
11
10
|
import org.embulk.filter.copy.forward.OutForwardService;
|
12
|
-
import org.embulk.filter.copy.forward.OutForwardVisitor;
|
13
11
|
import org.embulk.filter.copy.plugin.InternalForwardInputPlugin;
|
14
|
-
import org.embulk.filter.copy.
|
12
|
+
import org.embulk.filter.copy.runner.AsyncEmbulkRunnerService;
|
13
|
+
import org.embulk.filter.copy.runner.EmbulkRunner;
|
14
|
+
import org.embulk.filter.copy.spi.PageBuilder;
|
15
|
+
import org.embulk.filter.copy.spi.PageReader;
|
16
|
+
import org.embulk.filter.copy.spi.StandardColumnVisitor;
|
17
|
+
import org.embulk.spi.ColumnVisitor;
|
15
18
|
import org.embulk.spi.Exec;
|
16
19
|
import org.embulk.spi.FilterPlugin;
|
17
20
|
import org.embulk.spi.Page;
|
18
|
-
import org.embulk.spi.PageBuilder;
|
19
21
|
import org.embulk.spi.PageOutput;
|
20
|
-
import org.embulk.spi.PageReader;
|
21
22
|
import org.embulk.spi.Schema;
|
22
|
-
import org.embulk.spi.time.TimestampFormatter;
|
23
23
|
import org.slf4j.Logger;
|
24
24
|
|
25
25
|
import java.util.List;
|
@@ -45,14 +45,13 @@ public class CopyFilterPlugin
|
|
45
45
|
}
|
46
46
|
|
47
47
|
public interface PluginTask
|
48
|
-
extends Task,
|
49
|
-
OutForwardService.Task, InForwardService.Task
|
48
|
+
extends Task, OutForwardService.Task, InForwardService.Task
|
50
49
|
{
|
51
50
|
@Config("config")
|
52
51
|
EmbulkConfig getConfig();
|
53
52
|
}
|
54
53
|
|
55
|
-
private
|
54
|
+
private EmbulkRunner configure(PluginTask task, Schema schema)
|
56
55
|
{
|
57
56
|
ConfigSource inputConfig = Exec.newConfigSource();
|
58
57
|
inputConfig.set("type", InternalForwardInputPlugin.PLUGIN_NAME);
|
@@ -60,27 +59,21 @@ public class CopyFilterPlugin
|
|
60
59
|
inputConfig.set("message_tag", task.getMessageTag());
|
61
60
|
inputConfig.set("shutdown_tag", task.getShutdownTag());
|
62
61
|
inputConfig.set("in_forward", task.getInForwardTask());
|
63
|
-
inputConfig.set("default_timestamp_format", task.getDefaultTimestampFormat());
|
64
|
-
inputConfig.set("default_timezone", task.getDefaultTimeZone());
|
65
62
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
return embulkRunConfig;
|
63
|
+
return EmbulkRunner.builder()
|
64
|
+
.execConfig(task.getConfig().getExecConfig())
|
65
|
+
.inputConfig(inputConfig)
|
66
|
+
.filterConfig(task.getConfig().getFilterConfig())
|
67
|
+
.outputConfig(task.getConfig().getOutputConfig())
|
68
|
+
.build();
|
73
69
|
}
|
74
70
|
|
75
|
-
private void withEmbulkRun(
|
71
|
+
private void withEmbulkRun(AsyncEmbulkRunnerService service, Runnable r)
|
76
72
|
{
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
service.startAsync();
|
74
|
+
service.awaitRunning();
|
80
75
|
r.run();
|
81
|
-
|
82
|
-
executor.waitUntilExecutionFinished();
|
83
|
-
executor.shutdown();
|
76
|
+
service.awaitTerminated();
|
84
77
|
}
|
85
78
|
|
86
79
|
@Override
|
@@ -88,12 +81,12 @@ public class CopyFilterPlugin
|
|
88
81
|
FilterPlugin.Control control)
|
89
82
|
{
|
90
83
|
PluginTask task = config.loadConfig(PluginTask.class);
|
91
|
-
|
92
|
-
|
84
|
+
EmbulkRunner embulkRunner = configure(task, inputSchema);
|
85
|
+
AsyncEmbulkRunnerService embulkRunnerService = new AsyncEmbulkRunnerService(embulkRunner);
|
93
86
|
|
94
|
-
withEmbulkRun(
|
95
|
-
Schema
|
96
|
-
control.run(task.dump(),
|
87
|
+
withEmbulkRun(embulkRunnerService, () -> {
|
88
|
+
Schema outputSchema = inputSchema;
|
89
|
+
control.run(task.dump(), outputSchema);
|
97
90
|
OutForwardService.sendShutdownMessage(task);
|
98
91
|
});
|
99
92
|
}
|
@@ -103,10 +96,6 @@ public class CopyFilterPlugin
|
|
103
96
|
final Schema outputSchema, final PageOutput output)
|
104
97
|
{
|
105
98
|
final PluginTask task = taskSource.loadTask(PluginTask.class);
|
106
|
-
TimestampFormatter timestampFormatter = new TimestampFormatter(
|
107
|
-
task.getJRuby(),
|
108
|
-
task.getDefaultTimestampFormat(),
|
109
|
-
task.getDefaultTimeZone());
|
110
99
|
|
111
100
|
return new PageOutput()
|
112
101
|
{
|
@@ -114,8 +103,8 @@ public class CopyFilterPlugin
|
|
114
103
|
private final PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
|
115
104
|
private final StandardColumnVisitor standardColumnVisitor = new StandardColumnVisitor(pageReader, pageBuilder);
|
116
105
|
private final OutForwardService outForwardService = new OutForwardService(task);
|
117
|
-
private final OutForwardEventBuilder eventBuilder = new OutForwardEventBuilder(outputSchema,
|
118
|
-
private final
|
106
|
+
private final OutForwardEventBuilder eventBuilder = new OutForwardEventBuilder(outputSchema, outForwardService);
|
107
|
+
private final ColumnVisitor outForwardVisitor = new StandardColumnVisitor(pageReader, eventBuilder);
|
119
108
|
|
120
109
|
@Override
|
121
110
|
public void add(Page page)
|
@@ -123,7 +112,7 @@ public class CopyFilterPlugin
|
|
123
112
|
pageReader.setPage(page);
|
124
113
|
while (pageReader.nextRecord()) {
|
125
114
|
outputSchema.visitColumns(outForwardVisitor);
|
126
|
-
eventBuilder.
|
115
|
+
eventBuilder.addRecord();
|
127
116
|
|
128
117
|
outputSchema.visitColumns(standardColumnVisitor);
|
129
118
|
pageBuilder.addRecord();
|
@@ -1,147 +1,152 @@
|
|
1
1
|
package org.embulk.filter.copy.forward;
|
2
2
|
|
3
|
-
import com.google.common.collect.
|
4
|
-
import com.google.common.collect.Maps;
|
3
|
+
import com.google.common.collect.Lists;
|
5
4
|
import influent.EventStream;
|
6
5
|
import org.embulk.spi.Column;
|
7
6
|
import org.embulk.spi.Schema;
|
8
|
-
import org.embulk.spi.json.JsonParser;
|
9
7
|
import org.embulk.spi.time.Timestamp;
|
10
|
-
import org.embulk.spi.time.TimestampParser;
|
11
8
|
import org.msgpack.value.Value;
|
9
|
+
import org.embulk.filter.copy.spi.DataReader;
|
12
10
|
|
13
|
-
import java.util.
|
11
|
+
import java.util.List;
|
12
|
+
import java.util.Optional;
|
14
13
|
|
15
14
|
public class InForwardEventReader
|
15
|
+
implements DataReader
|
16
16
|
{
|
17
|
-
private final
|
18
|
-
private final Map<String, Column> columnMap;
|
19
|
-
|
20
|
-
private final JsonParser jsonParser = new JsonParser();
|
21
|
-
private final TimestampParser timestampParser;
|
17
|
+
private final static String VALUES_KEY = "values";
|
22
18
|
|
19
|
+
private final Schema schema;
|
23
20
|
private EventStream event = null;
|
24
21
|
private int eventMessageCount = 0;
|
25
22
|
|
26
23
|
private int readCount = 0;
|
27
|
-
private
|
24
|
+
private List<Value> values;
|
28
25
|
|
29
|
-
public InForwardEventReader(Schema schema
|
26
|
+
public InForwardEventReader(Schema schema)
|
30
27
|
{
|
31
28
|
this.schema = schema;
|
32
|
-
ImmutableMap.Builder<String, Column> builder = ImmutableMap.builder();
|
33
|
-
schema.getColumns().forEach(column -> builder.put(column.getName(), column));
|
34
|
-
this.columnMap = builder.build();
|
35
|
-
this.timestampParser = timestampParser;
|
36
29
|
}
|
37
30
|
|
38
|
-
public
|
31
|
+
public void setEvent(EventStream event)
|
39
32
|
{
|
40
|
-
|
33
|
+
this.event = event;
|
34
|
+
this.eventMessageCount = event.getEntries().size();
|
41
35
|
}
|
42
36
|
|
43
|
-
|
37
|
+
@Override
|
38
|
+
public Schema getSchema()
|
44
39
|
{
|
45
|
-
return
|
40
|
+
return schema;
|
46
41
|
}
|
47
42
|
|
48
|
-
|
43
|
+
@Override
|
44
|
+
public boolean nextRecord()
|
49
45
|
{
|
50
|
-
|
51
|
-
|
46
|
+
if (eventMessageCount <= readCount) {
|
47
|
+
return false;
|
48
|
+
}
|
52
49
|
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
Optional<List<Value>> values = event.getEntries().get(readCount++).getRecord().entrySet()
|
51
|
+
.stream()
|
52
|
+
.filter(valueValueEntry -> valueValueEntry.getKey().asStringValue().asString().contentEquals(VALUES_KEY))
|
53
|
+
.map(valueValueEntry -> valueValueEntry.getValue().asArrayValue().list())
|
54
|
+
.findFirst();
|
55
|
+
|
56
|
+
this.values = values.orElse(Lists.newArrayListWithCapacity(schema.getColumnCount()));
|
57
|
+
return true;
|
56
58
|
}
|
57
59
|
|
58
|
-
|
60
|
+
private Value getValue(int columnIndex)
|
59
61
|
{
|
60
|
-
|
61
|
-
this.eventMessageCount = event.getEntries().size();
|
62
|
+
return values.get(columnIndex);
|
62
63
|
}
|
63
64
|
|
65
|
+
@Override
|
64
66
|
public boolean isNull(Column column)
|
65
67
|
{
|
66
|
-
return
|
68
|
+
return isNull(column.getIndex());
|
67
69
|
}
|
68
70
|
|
71
|
+
@Override
|
69
72
|
public boolean isNull(int columnIndex)
|
70
73
|
{
|
71
|
-
return
|
74
|
+
return getValue(columnIndex).isNilValue();
|
72
75
|
}
|
73
76
|
|
77
|
+
@Override
|
74
78
|
public boolean getBoolean(Column column)
|
75
79
|
{
|
76
|
-
return
|
80
|
+
return getBoolean(column.getIndex());
|
77
81
|
}
|
78
82
|
|
83
|
+
@Override
|
79
84
|
public boolean getBoolean(int columnIndex)
|
80
85
|
{
|
81
|
-
return
|
86
|
+
return getValue(columnIndex).asBooleanValue().getBoolean();
|
82
87
|
}
|
83
88
|
|
84
|
-
|
89
|
+
@Override
|
90
|
+
public String getString(Column column)
|
85
91
|
{
|
86
|
-
return
|
92
|
+
return getString(column.getIndex());
|
87
93
|
}
|
88
94
|
|
89
|
-
|
95
|
+
@Override
|
96
|
+
public String getString(int columnIndex)
|
90
97
|
{
|
91
|
-
return
|
98
|
+
return getValue(columnIndex).asStringValue().asString();
|
92
99
|
}
|
93
100
|
|
94
|
-
|
101
|
+
@Override
|
102
|
+
public long getLong(Column column)
|
95
103
|
{
|
96
|
-
return
|
104
|
+
return getLong(column.getIndex());
|
97
105
|
}
|
98
106
|
|
99
|
-
|
107
|
+
@Override
|
108
|
+
public long getLong(int columnIndex)
|
100
109
|
{
|
101
|
-
return
|
110
|
+
return getValue(columnIndex).asIntegerValue().asLong();
|
102
111
|
}
|
103
112
|
|
104
|
-
|
113
|
+
@Override
|
114
|
+
public double getDouble(Column column)
|
105
115
|
{
|
106
|
-
return
|
116
|
+
return getDouble(column.getIndex());
|
107
117
|
}
|
108
118
|
|
109
|
-
|
119
|
+
@Override
|
120
|
+
public double getDouble(int columnIndex)
|
110
121
|
{
|
111
|
-
return
|
122
|
+
return getValue(columnIndex).asFloatValue().toDouble();
|
112
123
|
}
|
113
124
|
|
125
|
+
@Override
|
114
126
|
public Timestamp getTimestamp(Column column)
|
115
127
|
{
|
116
|
-
return
|
128
|
+
return getTimestamp(column.getIndex());
|
117
129
|
}
|
118
130
|
|
131
|
+
@Override
|
119
132
|
public Timestamp getTimestamp(int columnIndex)
|
120
133
|
{
|
121
|
-
|
134
|
+
List<Value> seed = getValue(columnIndex).asArrayValue().list();
|
135
|
+
long epochSecond = seed.get(0).asIntegerValue().asLong();
|
136
|
+
long nanoAdjustment = seed.get(1).asIntegerValue().asLong();
|
137
|
+
return Timestamp.ofEpochSecond(epochSecond, nanoAdjustment);
|
122
138
|
}
|
123
139
|
|
140
|
+
@Override
|
124
141
|
public Value getJson(Column column)
|
125
142
|
{
|
126
|
-
return
|
143
|
+
return getJson(column.getIndex());
|
127
144
|
}
|
128
145
|
|
146
|
+
@Override
|
129
147
|
public Value getJson(int columnIndex)
|
130
148
|
{
|
131
|
-
return
|
149
|
+
return getValue(columnIndex);
|
132
150
|
}
|
133
151
|
|
134
|
-
public boolean nextMessage()
|
135
|
-
{
|
136
|
-
if (eventMessageCount <= readCount) {
|
137
|
-
return false;
|
138
|
-
}
|
139
|
-
|
140
|
-
ImmutableMap.Builder<String, Value> builder = ImmutableMap.builder();
|
141
|
-
event.getEntries().get(readCount++).getRecord().entrySet().forEach(
|
142
|
-
entry -> builder.put(entry.getKey().toString(), entry.getValue())
|
143
|
-
);
|
144
|
-
message = builder.build();
|
145
|
-
return true;
|
146
|
-
}
|
147
152
|
}
|