embulk-output-td 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 666d33ca9f399f704557254a12fe57a64cea15e1
|
4
|
+
data.tar.gz: 39f9653363277e171d68efea0c522f8f1df7b823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f369e3e6b25df31d0275f17006a5670eab7b73ed495a4dd2240253d13b58bed2481cfe1f3d03e2926bf1c18aefc6477b39320f120cadc1c484239fa85563892
|
7
|
+
data.tar.gz: d426f8baff389eaa8fb81e1f1b9692d7587a45bb0d39bfe8dbf05e21c827d71b3800d075d1ec4a11bb224c94858ed49d9d3b8e6f2a2ca3d9d04a4314cb6da539
|
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
@@ -13,22 +13,23 @@ configurations {
|
|
13
13
|
provided
|
14
14
|
}
|
15
15
|
|
16
|
-
version = "0.1.
|
16
|
+
version = "0.1.4"
|
17
17
|
|
18
18
|
compileJava.options.encoding = 'UTF-8' // source encoding
|
19
19
|
sourceCompatibility = 1.7
|
20
20
|
targetCompatibility = 1.7
|
21
21
|
|
22
22
|
dependencies {
|
23
|
-
compile "org.embulk:embulk-core:0.6.
|
24
|
-
provided "org.embulk:embulk-core:0.6.
|
25
|
-
compile "org.embulk:embulk-standards:0.6.
|
26
|
-
provided "org.embulk:embulk-standards:0.6.
|
23
|
+
compile "org.embulk:embulk-core:0.6.25"
|
24
|
+
provided "org.embulk:embulk-core:0.6.25"
|
25
|
+
compile "org.embulk:embulk-standards:0.6.25"
|
26
|
+
provided "org.embulk:embulk-standards:0.6.25"
|
27
27
|
compile "org.eclipse.jetty:jetty-client:9.2.2.v20140723"
|
28
28
|
compile "org.msgpack:msgpack:0.6.11"
|
29
29
|
|
30
30
|
testCompile "junit:junit:4.+"
|
31
31
|
testCompile "org.bigtesting:fixd:1.0.0"
|
32
|
+
testCompile "org.embulk:embulk-core:0.6.25:tests"
|
32
33
|
}
|
33
34
|
|
34
35
|
task classpath(type: Copy, dependsOn: ["jar"]) {
|
data/embulk-output-td.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-output-td"
|
4
|
-
spec.version = "0.1.
|
4
|
+
spec.version = "0.1.4"
|
5
5
|
spec.authors = ["Muga Nishizawa"]
|
6
6
|
spec.summary = %[TreasureData output plugin for Embulk]
|
7
7
|
spec.description = %[TreasureData output plugin is an Embulk plugin that loads records to TreasureData read by any input plugins. Search the input plugins by 'embulk-output' keyword.]
|
@@ -317,7 +317,8 @@ public class RecordWriter
|
|
317
317
|
writer = new UnixTimestampLongFieldWriter(columnName, task.getUnixTimestampUnit().getFractionUnit());
|
318
318
|
hasPkWriter = true;
|
319
319
|
} else if (columnType instanceof TimestampType) {
|
320
|
-
writer = new
|
320
|
+
writer = new TimestampLongFieldWriter(columnName);
|
321
|
+
|
321
322
|
hasPkWriter = true;
|
322
323
|
} else {
|
323
324
|
throw new ConfigException(String.format("Type of '%s' column must be long or timestamp but got %s",
|
@@ -0,0 +1,105 @@
|
|
1
|
+
package org.embulk.output.td;
|
2
|
+
|
3
|
+
import com.google.common.collect.ImmutableList;
|
4
|
+
import org.embulk.EmbulkTestRuntime;
|
5
|
+
import org.embulk.config.ConfigLoader;
|
6
|
+
import org.embulk.config.ConfigSource;
|
7
|
+
import org.embulk.output.td.RecordWriter.FieldWriterSet;
|
8
|
+
import org.embulk.spi.Column;
|
9
|
+
import org.embulk.spi.ColumnConfig;
|
10
|
+
import org.embulk.spi.Exec;
|
11
|
+
import org.embulk.spi.Schema;
|
12
|
+
import org.embulk.spi.SchemaConfig;
|
13
|
+
import org.embulk.spi.type.Type;
|
14
|
+
import org.embulk.spi.type.Types;
|
15
|
+
import org.junit.Before;
|
16
|
+
import org.junit.Rule;
|
17
|
+
import org.junit.Test;
|
18
|
+
import org.slf4j.Logger;
|
19
|
+
|
20
|
+
import static org.junit.Assert.assertEquals;
|
21
|
+
import static org.junit.Assert.assertTrue;
|
22
|
+
|
23
|
+
public class TestFieldWriter
|
24
|
+
{
|
25
|
+
@Rule
|
26
|
+
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
27
|
+
|
28
|
+
private Logger log;
|
29
|
+
|
30
|
+
@Before
|
31
|
+
public void createLogger()
|
32
|
+
{
|
33
|
+
log = Exec.getLogger(TestFieldWriter.class);
|
34
|
+
}
|
35
|
+
|
36
|
+
private ConfigSource config()
|
37
|
+
{
|
38
|
+
return new ConfigLoader(runtime.getModelManager()).newConfigSource();
|
39
|
+
}
|
40
|
+
|
41
|
+
private Schema schema(Column... columns)
|
42
|
+
{
|
43
|
+
ImmutableList.Builder<Column> builder = new ImmutableList.Builder<Column>();
|
44
|
+
for (Column col : columns) {
|
45
|
+
builder.add(col);
|
46
|
+
}
|
47
|
+
return new Schema(builder.build());
|
48
|
+
}
|
49
|
+
|
50
|
+
private Column column(int index, String name, Type type)
|
51
|
+
{
|
52
|
+
return new Column(index, name, type);
|
53
|
+
}
|
54
|
+
|
55
|
+
private TdOutputPlugin.PluginTask task(ConfigSource outConfig)
|
56
|
+
{
|
57
|
+
return outConfig.loadConfig(TdOutputPlugin.PluginTask.class);
|
58
|
+
}
|
59
|
+
|
60
|
+
@Test
|
61
|
+
public void test()
|
62
|
+
{
|
63
|
+
{ // time column exists
|
64
|
+
// out: config
|
65
|
+
ConfigSource outConfig = config()
|
66
|
+
.set("apikey", "xxx")
|
67
|
+
.set("database", "mydb")
|
68
|
+
.set("table", "mytbl");
|
69
|
+
|
70
|
+
// schema
|
71
|
+
Schema schema = schema(
|
72
|
+
column(0, "time", Types.TIMESTAMP),
|
73
|
+
column(1, "c1", Types.TIMESTAMP));
|
74
|
+
|
75
|
+
// create field writers
|
76
|
+
FieldWriterSet writers = new FieldWriterSet(log, task(outConfig), schema);
|
77
|
+
|
78
|
+
assertEquals(schema.getColumnCount(), writers.getFieldCount());
|
79
|
+
assertTrue(writers.getFieldWriter(0) instanceof RecordWriter.TimestampLongFieldWriter);
|
80
|
+
assertTrue(writers.getFieldWriter(1) instanceof RecordWriter.TimestampStringFieldWriter);
|
81
|
+
}
|
82
|
+
|
83
|
+
{ // time column doesn't exists. users need to specify another column as time column
|
84
|
+
// out: config
|
85
|
+
ConfigSource outConfig = config()
|
86
|
+
.set("apikey", "xxx")
|
87
|
+
.set("database", "mydb")
|
88
|
+
.set("table", "mytbl")
|
89
|
+
.set("time_column", "c1");
|
90
|
+
TdOutputPlugin.PluginTask task = outConfig.loadConfig(TdOutputPlugin.PluginTask.class);
|
91
|
+
|
92
|
+
// schema
|
93
|
+
Schema schema = schema(
|
94
|
+
column(0, "c0", Types.TIMESTAMP),
|
95
|
+
column(1, "c1", Types.TIMESTAMP));
|
96
|
+
|
97
|
+
// create field writers
|
98
|
+
FieldWriterSet writers = new FieldWriterSet(log, task(outConfig), schema);
|
99
|
+
|
100
|
+
assertEquals(schema.getColumnCount() + 1, writers.getFieldCount());
|
101
|
+
assertTrue(writers.getFieldWriter(0) instanceof RecordWriter.TimestampStringFieldWriter);
|
102
|
+
assertTrue(writers.getFieldWriter(1) instanceof RecordWriter.TimestampFieldLongDuplicator);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muga Nishizawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,8 +85,9 @@ files:
|
|
85
85
|
- src/main/java/org/embulk/output/td/RecordWriter.java
|
86
86
|
- src/main/java/org/embulk/output/td/TdOutputPlugin.java
|
87
87
|
- src/test/java/com/treasuredata/api/TestTdApiClient.java
|
88
|
+
- src/test/java/org/embulk/output/td/TestFieldWriter.java
|
88
89
|
- src/test/java/org/embulk/output/td/TestTdOutputPlugin.java
|
89
|
-
- classpath/embulk-output-td-0.1.
|
90
|
+
- classpath/embulk-output-td-0.1.4.jar
|
90
91
|
- classpath/javassist-3.18.1-GA.jar
|
91
92
|
- classpath/jetty-client-9.2.2.v20140723.jar
|
92
93
|
- classpath/jetty-http-9.2.2.v20140723.jar
|