embulk-input-td 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d48f0bf7911cbd6c3a61ce1fc30469f6712a14
|
4
|
+
data.tar.gz: e6671f1c0fce07938927855290760b3e71ad7a1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d62f67b1ce5ea70b56d8c76bc8041218b8c25cb9b421d80ba459206c905a2ff70c6095bf81b87116e170d2e74c9fd9846693a53a76ae9064e8fa54b406e03b54
|
7
|
+
data.tar.gz: 0a1b580e1247fc433ac61b3c9728ed511de53e361dafaff90ef153f1bb1395274d799522dfbc016164f6a09b1be97ce5e522a50de066d98332b675ce1ff2bdb3
|
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
data/embulk-input-td.gemspec
CHANGED
@@ -34,6 +34,7 @@ import org.embulk.input.td.writer.DoubleValueWriter;
|
|
34
34
|
import org.embulk.input.td.writer.JsonValueWriter;
|
35
35
|
import org.embulk.input.td.writer.LongValueWriter;
|
36
36
|
import org.embulk.input.td.writer.StringValueWriter;
|
37
|
+
import org.embulk.input.td.writer.TimestampValueWriter;
|
37
38
|
import org.embulk.input.td.writer.ValueWriter;
|
38
39
|
import org.embulk.spi.BufferAllocator;
|
39
40
|
import org.embulk.spi.Column;
|
@@ -233,6 +234,8 @@ public class TdInputPlugin
|
|
233
234
|
} else if (p.scan("VARCHAR")) {
|
234
235
|
// TODO VARCHAR(n)
|
235
236
|
return Types.STRING;
|
237
|
+
} else if (p.scan("TIMESTAMP")) {
|
238
|
+
return Types.TIMESTAMP;
|
236
239
|
} else if (p.scan("ARRAY")) {
|
237
240
|
if (!p.scan("(")) {
|
238
241
|
throw new IllegalArgumentException(
|
@@ -416,8 +419,7 @@ public class TdInputPlugin
|
|
416
419
|
} else if (type.equals(Types.STRING)) {
|
417
420
|
return new StringValueWriter(column);
|
418
421
|
} else if (type.equals(Types.TIMESTAMP)) {
|
419
|
-
|
420
|
-
"Unsupported column type (%s:%s)", column.getName(), type)); // TODO
|
422
|
+
return new TimestampValueWriter(column);
|
421
423
|
} else {
|
422
424
|
throw new ConfigException(String.format(Locale.ENGLISH,
|
423
425
|
"Unsupported column type (%s:%s)", column.getName(), type)); // TODO
|
@@ -0,0 +1,28 @@
|
|
1
|
+
package org.embulk.input.td.writer;
|
2
|
+
|
3
|
+
import org.embulk.spi.Column;
|
4
|
+
import org.embulk.spi.PageBuilder;
|
5
|
+
import org.embulk.spi.time.Timestamp;
|
6
|
+
import org.msgpack.value.Value;
|
7
|
+
import java.util.Date;
|
8
|
+
import java.text.SimpleDateFormat;
|
9
|
+
|
10
|
+
public class TimestampValueWriter
|
11
|
+
extends AbstractValueWriter {
|
12
|
+
|
13
|
+
public TimestampValueWriter(final Column column) {
|
14
|
+
super(column);
|
15
|
+
}
|
16
|
+
|
17
|
+
@Override
|
18
|
+
public void writeNotNull(final Value v, final PageBuilder to) {
|
19
|
+
try {
|
20
|
+
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
21
|
+
Date formatedDate = format.parse(v.asStringValue().toString());
|
22
|
+
long miliseconds = formatedDate.getTime();
|
23
|
+
to.setTimestamp(index, Timestamp.ofEpochMilli(miliseconds));
|
24
|
+
} catch (Exception e) {
|
25
|
+
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muga Nishizawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- src/main/java/org/embulk/input/td/writer/JsonValueWriter.java
|
68
68
|
- src/main/java/org/embulk/input/td/writer/LongValueWriter.java
|
69
69
|
- src/main/java/org/embulk/input/td/writer/StringValueWriter.java
|
70
|
+
- src/main/java/org/embulk/input/td/writer/TimestampValueWriter.java
|
70
71
|
- src/main/java/org/embulk/input/td/writer/ValueWriter.java
|
71
72
|
- src/test/java/org/embulk/input/td/TestTdInputPlugin.java
|
72
73
|
- classpath/jackson-core-2.9.9.jar
|
@@ -74,7 +75,7 @@ files:
|
|
74
75
|
- classpath/jackson-datatype-json-org-2.9.9.jar
|
75
76
|
- classpath/okhttp-3.12.0.jar
|
76
77
|
- classpath/junit-4.10.jar
|
77
|
-
- classpath/embulk-input-td-0.2.
|
78
|
+
- classpath/embulk-input-td-0.2.3.jar
|
78
79
|
- classpath/json-20171018.jar
|
79
80
|
- classpath/guava-21.0.jar
|
80
81
|
- classpath/jackson-datatype-guava-2.9.9.jar
|