embulk-filter-timestamp_format 0.3.0 → 0.3.1
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: 94f9cf903e02ed4a2c7a2fcbcd246d54e4d79918
|
4
|
+
data.tar.gz: e7a9224bb84bff01a5b177e6cea65b4535142219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b0134f40cb27a9256c8fda3b694ccd7ca4bdd56c58e91f4002b9af21dc9883dcea42d725e397de176a45986ae2fd6bb253f4162fdd51c3271ea7e250a0b1661
|
7
|
+
data.tar.gz: c37e4f3210911938e33aab11dd1e977167d53f0b2234537a58370ce7e94536dc37c071c3936ebbafb4cf33a53b7f44131ae84dc5f392ae942e021543280ecbbb
|
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
@@ -13,13 +13,13 @@ configurations {
|
|
13
13
|
provided
|
14
14
|
}
|
15
15
|
|
16
|
-
version = "0.3.
|
16
|
+
version = "0.3.1"
|
17
17
|
sourceCompatibility = 1.7
|
18
18
|
targetCompatibility = 1.7
|
19
19
|
|
20
20
|
dependencies {
|
21
|
-
compile "org.embulk:embulk-core:0.8
|
22
|
-
provided "org.embulk:embulk-core:0.8
|
21
|
+
compile "org.embulk:embulk-core:0.8.+"
|
22
|
+
provided "org.embulk:embulk-core:0.8.+"
|
23
23
|
compile "io.github.medjed:JsonPathCompiler:0.1.+"
|
24
24
|
|
25
25
|
testCompile "junit:junit:4.+"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#Wed
|
1
|
+
#Wed Aug 09 13:08:20 JST 2017
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
3
3
|
distributionPath=wrapper/dists
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
@@ -25,6 +25,7 @@ import java.util.regex.Matcher;
|
|
25
25
|
import java.util.regex.Pattern;
|
26
26
|
|
27
27
|
import org.joda.time.format.DateTimeFormat;
|
28
|
+
import org.jruby.embed.ScriptingContainer;
|
28
29
|
|
29
30
|
public class TimestampParser {
|
30
31
|
public interface Task {
|
@@ -66,7 +67,7 @@ public class TimestampParser {
|
|
66
67
|
// TODO get default current time from ExecTask.getExecTimestamp
|
67
68
|
for (String format : formatList) {
|
68
69
|
if (format.contains("%")) {
|
69
|
-
org.embulk.spi.time.TimestampParser parser =
|
70
|
+
org.embulk.spi.time.TimestampParser parser = getTimestampParser(format, defaultFromTimeZone);
|
70
71
|
this.jrubyParserList.add(parser);
|
71
72
|
} else {
|
72
73
|
// special treatment for nano resolution. n is not originally supported by Joda-Time
|
@@ -168,4 +169,83 @@ public class TimestampParser {
|
|
168
169
|
}
|
169
170
|
return nsec;
|
170
171
|
}
|
172
|
+
|
173
|
+
private class TimestampParserTaskImpl implements org.embulk.spi.time.TimestampParser.Task
|
174
|
+
{
|
175
|
+
private final DateTimeZone defaultTimeZone;
|
176
|
+
private final String defaultTimestampFormat;
|
177
|
+
private final String defaultDate;
|
178
|
+
public TimestampParserTaskImpl(
|
179
|
+
DateTimeZone defaultTimeZone,
|
180
|
+
String defaultTimestampFormat,
|
181
|
+
String defaultDate)
|
182
|
+
{
|
183
|
+
this.defaultTimeZone = defaultTimeZone;
|
184
|
+
this.defaultTimestampFormat = defaultTimestampFormat;
|
185
|
+
this.defaultDate = defaultDate;
|
186
|
+
}
|
187
|
+
@Override
|
188
|
+
public DateTimeZone getDefaultTimeZone()
|
189
|
+
{
|
190
|
+
return this.defaultTimeZone;
|
191
|
+
}
|
192
|
+
@Override
|
193
|
+
public String getDefaultTimestampFormat()
|
194
|
+
{
|
195
|
+
return this.defaultTimestampFormat;
|
196
|
+
}
|
197
|
+
@Override
|
198
|
+
public String getDefaultDate()
|
199
|
+
{
|
200
|
+
return this.defaultDate;
|
201
|
+
}
|
202
|
+
@Override
|
203
|
+
public ScriptingContainer getJRuby()
|
204
|
+
{
|
205
|
+
return null;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
private class TimestampParserColumnOptionImpl implements org.embulk.spi.time.TimestampParser.TimestampColumnOption
|
210
|
+
{
|
211
|
+
private final Optional<DateTimeZone> timeZone;
|
212
|
+
private final Optional<String> format;
|
213
|
+
private final Optional<String> date;
|
214
|
+
public TimestampParserColumnOptionImpl(
|
215
|
+
Optional<DateTimeZone> timeZone,
|
216
|
+
Optional<String> format,
|
217
|
+
Optional<String> date)
|
218
|
+
{
|
219
|
+
this.timeZone = timeZone;
|
220
|
+
this.format = format;
|
221
|
+
this.date = date;
|
222
|
+
}
|
223
|
+
@Override
|
224
|
+
public Optional<DateTimeZone> getTimeZone()
|
225
|
+
{
|
226
|
+
return this.timeZone;
|
227
|
+
}
|
228
|
+
@Override
|
229
|
+
public Optional<String> getFormat()
|
230
|
+
{
|
231
|
+
return this.format;
|
232
|
+
}
|
233
|
+
@Override
|
234
|
+
public Optional<String> getDate()
|
235
|
+
{
|
236
|
+
return this.date;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
private org.embulk.spi.time.TimestampParser getTimestampParser(String format, DateTimeZone timezone)
|
241
|
+
{
|
242
|
+
// ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
|
243
|
+
//
|
244
|
+
// return new org.embulk.spi.time.TimestampParser(format, timezone);
|
245
|
+
String date = "1970-01-01";
|
246
|
+
TimestampParserTaskImpl task = new TimestampParserTaskImpl(timezone, format, date);
|
247
|
+
TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
|
248
|
+
Optional.of(timezone), Optional.of(format), Optional.of(date));
|
249
|
+
return new org.embulk.spi.time.TimestampParser(task, columnOption);
|
250
|
+
}
|
171
251
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-timestamp_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,7 +110,7 @@ files:
|
|
110
110
|
- src/test/java/org/embulk/filter/timestamp_format/TestTimestampUnit.java
|
111
111
|
- classpath/accessors-smart-1.1.jar
|
112
112
|
- classpath/asm-5.0.3.jar
|
113
|
-
- classpath/embulk-filter-timestamp_format-0.3.
|
113
|
+
- classpath/embulk-filter-timestamp_format-0.3.1.jar
|
114
114
|
- classpath/json-smart-2.2.1.jar
|
115
115
|
- classpath/JsonPathCompiler-0.1.2.jar
|
116
116
|
- classpath/slf4j-api-1.7.21.jar
|