embulk-filter-add_time 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +3 -0
- data/COPYING +14 -0
- data/README.md +212 -0
- data/build.gradle +82 -0
- data/gradle/check.gradle +34 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/gradlew +164 -0
- data/gradlew.bat +90 -0
- data/lib/embulk/filter/add_time.rb +3 -0
- data/src/main/java/org/embulk/filter/add_time/AddTimeFilterPlugin.java +208 -0
- data/src/main/java/org/embulk/filter/add_time/converter/ColumnConverter.java +14 -0
- data/src/main/java/org/embulk/filter/add_time/converter/ColumnDuplicator.java +72 -0
- data/src/main/java/org/embulk/filter/add_time/converter/LongValueCastConverter.java +33 -0
- data/src/main/java/org/embulk/filter/add_time/converter/SchemaConverter.java +257 -0
- data/src/main/java/org/embulk/filter/add_time/converter/SimpleColumnConverter.java +62 -0
- data/src/main/java/org/embulk/filter/add_time/converter/StringValueCastConverter.java +33 -0
- data/src/main/java/org/embulk/filter/add_time/converter/TimestampValueCastConverter.java +23 -0
- data/src/main/java/org/embulk/filter/add_time/converter/ValueCastConverter.java +108 -0
- data/src/main/java/org/embulk/filter/add_time/converter/ValueConverter.java +22 -0
- data/src/main/java/org/embulk/filter/add_time/converter/ValueNoConverter.java +46 -0
- data/src/main/java/org/embulk/filter/add_time/reader/AbstractColumnReader.java +55 -0
- data/src/main/java/org/embulk/filter/add_time/reader/BooleanColumnReader.java +35 -0
- data/src/main/java/org/embulk/filter/add_time/reader/ColumnReader.java +14 -0
- data/src/main/java/org/embulk/filter/add_time/reader/DoubleColumnReader.java +35 -0
- data/src/main/java/org/embulk/filter/add_time/reader/LongColumnReader.java +35 -0
- data/src/main/java/org/embulk/filter/add_time/reader/StringColumnReader.java +35 -0
- data/src/main/java/org/embulk/filter/add_time/reader/TimeValueGenerator.java +177 -0
- data/src/main/java/org/embulk/filter/add_time/reader/TimestampColumnReader.java +36 -0
- data/src/test/java/org/embulk/filter/add_time/TestAddTimeFilterPlugin.java +416 -0
- data/src/test/java/org/embulk/filter/add_time/converter/TestSchemaConverter.java +338 -0
- metadata +107 -0
@@ -0,0 +1,338 @@
|
|
1
|
+
package org.embulk.filter.add_time.converter;
|
2
|
+
|
3
|
+
import com.google.common.collect.ImmutableMap;
|
4
|
+
import org.embulk.EmbulkTestRuntime;
|
5
|
+
import org.embulk.config.ConfigException;
|
6
|
+
import org.embulk.config.ConfigSource;
|
7
|
+
import org.embulk.spi.Column;
|
8
|
+
import org.embulk.spi.Schema;
|
9
|
+
import org.embulk.spi.type.Types;
|
10
|
+
import org.junit.Before;
|
11
|
+
import org.junit.Rule;
|
12
|
+
import org.junit.Test;
|
13
|
+
import org.slf4j.Logger;
|
14
|
+
|
15
|
+
import java.util.ArrayList;
|
16
|
+
|
17
|
+
import static org.embulk.filter.add_time.TestAddTimeFilterPlugin.pluginTask;
|
18
|
+
import static org.embulk.filter.add_time.TestAddTimeFilterPlugin.schema;
|
19
|
+
import static org.junit.Assert.assertEquals;
|
20
|
+
import static org.junit.Assert.assertTrue;
|
21
|
+
import static org.junit.Assert.fail;
|
22
|
+
|
23
|
+
public class TestSchemaConverter
|
24
|
+
{
|
25
|
+
@Rule
|
26
|
+
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
27
|
+
|
28
|
+
private Logger log;
|
29
|
+
private ConfigSource config;
|
30
|
+
|
31
|
+
@Before
|
32
|
+
public void createResources()
|
33
|
+
{
|
34
|
+
log = runtime.getExec().getLogger(TestSchemaConverter.class);
|
35
|
+
config = runtime.getExec().newConfigSource();
|
36
|
+
}
|
37
|
+
|
38
|
+
@Test
|
39
|
+
public void validate()
|
40
|
+
{
|
41
|
+
// if to_column doesn't exist, throws ConfigException
|
42
|
+
{
|
43
|
+
ConfigSource conf = this.config.deepCopy()
|
44
|
+
.set("from_value", ImmutableMap.of("mode", "upload_time"));
|
45
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
46
|
+
}
|
47
|
+
|
48
|
+
// if both from_column and from_value exist, throws ConfigException
|
49
|
+
{
|
50
|
+
ConfigSource conf = this.config.deepCopy()
|
51
|
+
.set("to_column", ImmutableMap.of("name", "time"))
|
52
|
+
.set("from_column", ImmutableMap.of("name", "c0"))
|
53
|
+
.set("from_value", ImmutableMap.of("mode", "upload_time"));
|
54
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
55
|
+
}
|
56
|
+
|
57
|
+
// if from_column or from_value doesn't exist, throws ConfigException
|
58
|
+
{
|
59
|
+
ConfigSource conf = this.config.deepCopy()
|
60
|
+
.set("to_column", ImmutableMap.of("name", "time"));
|
61
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
62
|
+
}
|
63
|
+
|
64
|
+
// if from_value type is not string or long, throws ConfigException
|
65
|
+
{
|
66
|
+
ConfigSource conf = this.config.deepCopy()
|
67
|
+
.set("to_column", ImmutableMap.of("name", "time"))
|
68
|
+
.set("from_value", ImmutableMap.of("mode", "fixed_time", "value", new ArrayList<Long>()));
|
69
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
70
|
+
}
|
71
|
+
{
|
72
|
+
ConfigSource conf = this.config.deepCopy()
|
73
|
+
.set("to_column", ImmutableMap.of("name", "time"))
|
74
|
+
.set("from_value", ImmutableMap.of("mode", "incremental_time", "from", new ArrayList<Long>(), "to", new ArrayList<Long>()));
|
75
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
76
|
+
}
|
77
|
+
|
78
|
+
// the type of the column specified as to_column must be 'long' or 'timestamp'
|
79
|
+
{ // boolean
|
80
|
+
ConfigSource conf = this.config.deepCopy()
|
81
|
+
.set("to_column", ImmutableMap.of("name", "time", "type", "boolean"))
|
82
|
+
.set("from_column", ImmutableMap.of("name", "c0"));
|
83
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
84
|
+
}
|
85
|
+
{ // double
|
86
|
+
ConfigSource conf = this.config.deepCopy()
|
87
|
+
.set("to_column", ImmutableMap.of("name", "time", "type", "double"))
|
88
|
+
.set("from_column", ImmutableMap.of("name", "c0"));
|
89
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
90
|
+
}
|
91
|
+
{ // string
|
92
|
+
ConfigSource conf = this.config.deepCopy()
|
93
|
+
.set("to_column", ImmutableMap.of("name", "time", "type", "string"))
|
94
|
+
.set("from_column", ImmutableMap.of("name", "c0"));
|
95
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
|
96
|
+
}
|
97
|
+
|
98
|
+
// the type of the column specified as from_column must be 'long', 'timestamp' or 'string'
|
99
|
+
{
|
100
|
+
ConfigSource conf = this.config.deepCopy()
|
101
|
+
.set("to_column", ImmutableMap.of("name", "time"))
|
102
|
+
.set("from_column", ImmutableMap.of("name", "c0"));
|
103
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.BOOLEAN)); // boolean
|
104
|
+
failSchemaConverterCreation(log, conf, schema("c0", Types.DOUBLE)); // double
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
private static void failSchemaConverterCreation(Logger log, ConfigSource conf, Schema inputSchema)
|
109
|
+
{
|
110
|
+
try {
|
111
|
+
new SchemaConverter(log, pluginTask(conf), inputSchema);
|
112
|
+
fail();
|
113
|
+
}
|
114
|
+
catch (Throwable t) {
|
115
|
+
assertTrue(t instanceof ConfigException);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
@Test
|
120
|
+
public void testToColumn()
|
121
|
+
{
|
122
|
+
ConfigSource config = this.config.deepCopy().set("from_value", ImmutableMap.of("mode", "upload_time"));
|
123
|
+
|
124
|
+
// timestamp type
|
125
|
+
{ // default type is timestamp
|
126
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "time"));
|
127
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
128
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
129
|
+
|
130
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
131
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
132
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
133
|
+
}
|
134
|
+
{
|
135
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "time", "type", "timestamp"));
|
136
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
137
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
138
|
+
|
139
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
140
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
141
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
142
|
+
}
|
143
|
+
|
144
|
+
// long type
|
145
|
+
{ // default unix_timestamp_unit is sec
|
146
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "time", "type", "long"));
|
147
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
148
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
149
|
+
|
150
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
151
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
152
|
+
assertEquals(new Column(1, "time", Types.LONG), outputSchema.getColumn(1));
|
153
|
+
}
|
154
|
+
{ // default unix_timestamp_unit is sec
|
155
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "time", "type", "long", "unix_timestamp_unit", "milli"));
|
156
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
157
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
158
|
+
|
159
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
160
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
161
|
+
assertEquals(new Column(1, "time", Types.LONG), outputSchema.getColumn(1));
|
162
|
+
}
|
163
|
+
|
164
|
+
// renaming
|
165
|
+
{ // timestamp type
|
166
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "c0"));
|
167
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
168
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
169
|
+
|
170
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
171
|
+
assertEquals(new Column(0, "c0_", Types.TIMESTAMP), outputSchema.getColumn(0));
|
172
|
+
assertEquals(new Column(1, "c0", Types.TIMESTAMP), outputSchema.getColumn(1));
|
173
|
+
}
|
174
|
+
{ // timestamp type
|
175
|
+
ConfigSource conf = config.deepCopy().set("to_column", ImmutableMap.of("name", "c0"));
|
176
|
+
Schema inputSchema = schema("c0", Types.LONG);
|
177
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
178
|
+
|
179
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
180
|
+
assertEquals(new Column(0, "c0_", Types.LONG), outputSchema.getColumn(0));
|
181
|
+
assertEquals(new Column(1, "c0", Types.TIMESTAMP), outputSchema.getColumn(1));
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
@Test
|
186
|
+
public void testFromColumn()
|
187
|
+
{
|
188
|
+
ConfigSource config = this.config.deepCopy().set("to_column", ImmutableMap.of("name", "time"));
|
189
|
+
|
190
|
+
// timestamp type
|
191
|
+
{
|
192
|
+
ConfigSource conf = config.deepCopy().set("from_column", ImmutableMap.of("name", "c0"));
|
193
|
+
Schema inputSchema = schema("c0", Types.TIMESTAMP);
|
194
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
195
|
+
|
196
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
197
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
198
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
199
|
+
}
|
200
|
+
|
201
|
+
// long type
|
202
|
+
{
|
203
|
+
ConfigSource conf = config.deepCopy().set("from_column", ImmutableMap.of("name", "c0"));
|
204
|
+
Schema inputSchema = schema("c0", Types.LONG);
|
205
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
206
|
+
|
207
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
208
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
209
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
210
|
+
}
|
211
|
+
{
|
212
|
+
ConfigSource conf = config.deepCopy().set("from_column", ImmutableMap.of("name", "c0", "unix_timestamp_unit", "sec"));
|
213
|
+
Schema inputSchema = schema("c0", Types.LONG);
|
214
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
215
|
+
|
216
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
217
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
218
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
219
|
+
}
|
220
|
+
|
221
|
+
// string type
|
222
|
+
{
|
223
|
+
ConfigSource conf = config.deepCopy().set("from_column", ImmutableMap.of("name", "c0"));
|
224
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
225
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
226
|
+
|
227
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
228
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
229
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
230
|
+
}
|
231
|
+
{
|
232
|
+
ConfigSource conf = config.deepCopy().set("from_column", ImmutableMap.of("name", "c0", "timestamp_format", "%Y-%m-%d %H:%M:%S.%N %Z"));
|
233
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
234
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
235
|
+
|
236
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
237
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
238
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
@Test
|
243
|
+
public void testFromValue()
|
244
|
+
{
|
245
|
+
ConfigSource config = this.config.deepCopy().set("to_column", ImmutableMap.of("name", "time"));
|
246
|
+
|
247
|
+
// mode: fixed_time
|
248
|
+
{ // default mode
|
249
|
+
ConfigSource conf = config.deepCopy().set("from_value", ImmutableMap.of("value", "2016-01-01 10:10:10 UTC"));
|
250
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
251
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
252
|
+
|
253
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
254
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
255
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
256
|
+
}
|
257
|
+
{
|
258
|
+
ConfigSource conf = config.deepCopy().set("from_value", ImmutableMap.of("mode", "fixed_time", "value", "2016-01-01 10:10:10 UTC"));
|
259
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
260
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
261
|
+
|
262
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
263
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
264
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
265
|
+
}
|
266
|
+
{ // specify 'timestamp_format'
|
267
|
+
ConfigSource conf = config.deepCopy()
|
268
|
+
.set("from_value", ImmutableMap.of("mode", "fixed_time", "value", "2016-01-01 10:10:10.000 UTC",
|
269
|
+
"timestamp_format", "%Y-%m-%d %H:%M:%S.%N %Z"));
|
270
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
271
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
272
|
+
|
273
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
274
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
275
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
276
|
+
}
|
277
|
+
{ // specify 'unix_timestamp_unit'
|
278
|
+
ConfigSource conf = config.deepCopy()
|
279
|
+
.set("from_value", ImmutableMap.of("mode", "fixed_time", "value", 1451643010,
|
280
|
+
"unix_timestamp_unit", "sec"));
|
281
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
282
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
283
|
+
|
284
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
285
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
286
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
287
|
+
}
|
288
|
+
|
289
|
+
// mode: incremental_time
|
290
|
+
{
|
291
|
+
ConfigSource conf = config.deepCopy()
|
292
|
+
.set("from_value", ImmutableMap.of("mode", "incremental_time",
|
293
|
+
"from", "2016-01-01 10:10:10 UTC", "to", "2016-01-01 10:10:10 UTC"));
|
294
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
295
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
296
|
+
|
297
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
298
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
299
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
300
|
+
}
|
301
|
+
{ // specify 'timestamp_format'
|
302
|
+
ConfigSource conf = config.deepCopy()
|
303
|
+
.set("from_value", ImmutableMap.of("mode", "incremental_time",
|
304
|
+
"from", "2016-01-01 10:10:10.000 UTC", "to", "2016-01-01 10:10:10.000 UTC", "timestamp_format", "%Y-%m-%d %H:%M:%S.%N %Z"));
|
305
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
306
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
307
|
+
|
308
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
309
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
310
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
311
|
+
}
|
312
|
+
{ // specify 'unix_timestamp_unit'
|
313
|
+
ConfigSource conf = config.deepCopy()
|
314
|
+
.set("from_value", ImmutableMap.of("mode", "incremental_time",
|
315
|
+
"from", 1451643010, "to", 1451643010, "unix_timestamp_unit", "sec"));
|
316
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
317
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
318
|
+
|
319
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
320
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
321
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
322
|
+
}
|
323
|
+
|
324
|
+
// mode: upload_time
|
325
|
+
{
|
326
|
+
ConfigSource conf = config.deepCopy()
|
327
|
+
.set("from_value", ImmutableMap.of(
|
328
|
+
"mode", "upload_time"));
|
329
|
+
Schema inputSchema = schema("c0", Types.STRING);
|
330
|
+
Schema outputSchema = new SchemaConverter(log, pluginTask(conf), inputSchema).toOutputSchema();
|
331
|
+
|
332
|
+
assertEquals(inputSchema.size() + 1, outputSchema.size());
|
333
|
+
assertEquals(inputSchema.getColumn(0), outputSchema.getColumn(0));
|
334
|
+
assertEquals(new Column(1, "time", Types.TIMESTAMP), outputSchema.getColumn(1));
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
}
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: embulk-filter-add_time
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Muga Nishizawa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.0'
|
19
|
+
name: bundler
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '10.0'
|
33
|
+
name: rake
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Add time column to the schema
|
42
|
+
email:
|
43
|
+
- muga.nishizawa@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- CHANGELOG.md
|
51
|
+
- COPYING
|
52
|
+
- README.md
|
53
|
+
- build.gradle
|
54
|
+
- embulk-filter-add_time.gemspec
|
55
|
+
- gradle/check.gradle
|
56
|
+
- gradle/wrapper/gradle-wrapper.jar
|
57
|
+
- gradle/wrapper/gradle-wrapper.properties
|
58
|
+
- gradlew
|
59
|
+
- gradlew.bat
|
60
|
+
- lib/embulk/filter/add_time.rb
|
61
|
+
- src/main/java/org/embulk/filter/add_time/AddTimeFilterPlugin.java
|
62
|
+
- src/main/java/org/embulk/filter/add_time/converter/ColumnConverter.java
|
63
|
+
- src/main/java/org/embulk/filter/add_time/converter/ColumnDuplicator.java
|
64
|
+
- src/main/java/org/embulk/filter/add_time/converter/LongValueCastConverter.java
|
65
|
+
- src/main/java/org/embulk/filter/add_time/converter/SchemaConverter.java
|
66
|
+
- src/main/java/org/embulk/filter/add_time/converter/SimpleColumnConverter.java
|
67
|
+
- src/main/java/org/embulk/filter/add_time/converter/StringValueCastConverter.java
|
68
|
+
- src/main/java/org/embulk/filter/add_time/converter/TimestampValueCastConverter.java
|
69
|
+
- src/main/java/org/embulk/filter/add_time/converter/ValueCastConverter.java
|
70
|
+
- src/main/java/org/embulk/filter/add_time/converter/ValueConverter.java
|
71
|
+
- src/main/java/org/embulk/filter/add_time/converter/ValueNoConverter.java
|
72
|
+
- src/main/java/org/embulk/filter/add_time/reader/AbstractColumnReader.java
|
73
|
+
- src/main/java/org/embulk/filter/add_time/reader/BooleanColumnReader.java
|
74
|
+
- src/main/java/org/embulk/filter/add_time/reader/ColumnReader.java
|
75
|
+
- src/main/java/org/embulk/filter/add_time/reader/DoubleColumnReader.java
|
76
|
+
- src/main/java/org/embulk/filter/add_time/reader/LongColumnReader.java
|
77
|
+
- src/main/java/org/embulk/filter/add_time/reader/StringColumnReader.java
|
78
|
+
- src/main/java/org/embulk/filter/add_time/reader/TimeValueGenerator.java
|
79
|
+
- src/main/java/org/embulk/filter/add_time/reader/TimestampColumnReader.java
|
80
|
+
- src/test/java/org/embulk/filter/add_time/TestAddTimeFilterPlugin.java
|
81
|
+
- src/test/java/org/embulk/filter/add_time/converter/TestSchemaConverter.java
|
82
|
+
- classpath/embulk-filter-add_time-0.1.0.jar
|
83
|
+
homepage: https://github.com/treasure-data/embulk-filter-add_time
|
84
|
+
licenses:
|
85
|
+
- Apache 2.0
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.1.9
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Add time filter plugin for Embulk
|
107
|
+
test_files: []
|