embulk 0.8.8 → 0.8.9
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 +4 -4
- data/build.gradle +1 -1
- data/embulk-core/build.gradle +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +41 -3
- data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParser.java +12 -0
- data/embulk-docs/src/release.rst +1 -0
- data/embulk-docs/src/release/release-0.8.9.rst +14 -0
- data/lib/embulk/command/embulk_example.rb +1 -0
- data/lib/embulk/data/bundle/.ruby-version +1 -1
- data/lib/embulk/data/bundle/Gemfile +1 -1
- data/lib/embulk/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2f4ce6246c951b41b33a123f74e33d54324a865
|
4
|
+
data.tar.gz: 7c7bb33676ac7bcad4bc03dec3b843242b5ebf15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4921463f2ec39d4f47981692059f2221eb98003d94a063a09b0fda6cae4fb697053a5199ce2abfc31d29e43d172d24b01eacacbb1b287e80f0a93abe4d698af
|
7
|
+
data.tar.gz: bb264a3a0528502f42222d6c86ec8d5d06214bdfd7bb29c06e9c1fd9252900a7a93b70c1316423a7338672ec05bff6382c1412fed8585a4461ebc1d9340b2997
|
data/build.gradle
CHANGED
data/embulk-core/build.gradle
CHANGED
@@ -38,7 +38,7 @@ dependencies {
|
|
38
38
|
compile 'joda-time:joda-time:2.9.2'
|
39
39
|
compile 'io.netty:netty-buffer:5.0.0.Alpha1'
|
40
40
|
compile 'org.fusesource.jansi:jansi:1.11'
|
41
|
-
compile 'org.msgpack:msgpack-core:0.8.
|
41
|
+
compile 'org.msgpack:msgpack-core:0.8.7'
|
42
42
|
|
43
43
|
// For embulk/guess/charset.rb. See also embulk.gemspec
|
44
44
|
compile 'com.ibm.icu:icu4j:54.1.1'
|
@@ -1,11 +1,18 @@
|
|
1
1
|
package org.embulk.spi.time;
|
2
2
|
|
3
|
+
import java.util.Date;
|
4
|
+
import java.util.Locale;
|
5
|
+
import java.util.TimeZone;
|
6
|
+
import java.util.Calendar;
|
7
|
+
import java.text.SimpleDateFormat;
|
8
|
+
import java.text.ParseException;
|
3
9
|
import org.joda.time.DateTimeZone;
|
4
10
|
import com.google.common.base.Optional;
|
5
11
|
import org.jruby.embed.ScriptingContainer;
|
6
12
|
import org.embulk.config.Config;
|
7
13
|
import org.embulk.config.ConfigInject;
|
8
14
|
import org.embulk.config.ConfigDefault;
|
15
|
+
import org.embulk.config.ConfigException;
|
9
16
|
import static org.embulk.spi.time.TimestampFormat.parseDateTimeZone;
|
10
17
|
|
11
18
|
public class TimestampParser
|
@@ -32,6 +39,10 @@ public class TimestampParser
|
|
32
39
|
@ConfigDefault("\"%Y-%m-%d %H:%M:%S.%N %z\"")
|
33
40
|
public String getDefaultTimestampFormat();
|
34
41
|
|
42
|
+
@Config("default_date")
|
43
|
+
@ConfigDefault("\"1970-01-01\"")
|
44
|
+
public String getDefaultDate();
|
45
|
+
|
35
46
|
@ConfigInject
|
36
47
|
public ScriptingContainer getJRuby();
|
37
48
|
}
|
@@ -45,6 +56,10 @@ public class TimestampParser
|
|
45
56
|
@Config("format")
|
46
57
|
@ConfigDefault("null")
|
47
58
|
public Optional<String> getFormat();
|
59
|
+
|
60
|
+
@Config("date")
|
61
|
+
@ConfigDefault("null")
|
62
|
+
public Optional<String> getDate();
|
48
63
|
}
|
49
64
|
|
50
65
|
private final JRubyTimeParserHelper helper;
|
@@ -58,21 +73,44 @@ public class TimestampParser
|
|
58
73
|
|
59
74
|
TimestampParser(Task task)
|
60
75
|
{
|
61
|
-
this(task.getJRuby(), task.getDefaultTimestampFormat(), task.getDefaultTimeZone());
|
76
|
+
this(task.getJRuby(), task.getDefaultTimestampFormat(), task.getDefaultTimeZone(), task.getDefaultDate());
|
62
77
|
}
|
63
78
|
|
64
79
|
public TimestampParser(Task task, TimestampColumnOption columnOption)
|
65
80
|
{
|
66
81
|
this(task.getJRuby(),
|
67
82
|
columnOption.getFormat().or(task.getDefaultTimestampFormat()),
|
68
|
-
columnOption.getTimeZone().or(task.getDefaultTimeZone())
|
83
|
+
columnOption.getTimeZone().or(task.getDefaultTimeZone()),
|
84
|
+
columnOption.getDate().or(task.getDefaultDate()));
|
69
85
|
}
|
70
86
|
|
71
87
|
public TimestampParser(ScriptingContainer jruby, String format, DateTimeZone defaultTimeZone)
|
88
|
+
{
|
89
|
+
this(jruby, format, defaultTimeZone, "1970-01-01");
|
90
|
+
}
|
91
|
+
|
92
|
+
public TimestampParser(ScriptingContainer jruby, String format, DateTimeZone defaultTimeZone, String defaultDate)
|
72
93
|
{
|
73
94
|
JRubyTimeParserHelperFactory helperFactory = (JRubyTimeParserHelperFactory) jruby.runScriptlet("Embulk::Java::TimeParserHelper::Factory.new");
|
95
|
+
|
96
|
+
// calculate default date
|
97
|
+
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
|
98
|
+
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
99
|
+
Date utc;
|
100
|
+
try {
|
101
|
+
utc = df.parse(defaultDate);
|
102
|
+
}
|
103
|
+
catch (ParseException ex) {
|
104
|
+
throw new ConfigException("Invalid date format. Expected yyyy-MM-dd: " + defaultDate);
|
105
|
+
}
|
106
|
+
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ENGLISH);
|
107
|
+
cal.setTime(utc);
|
108
|
+
int year = cal.get(Calendar.YEAR);
|
109
|
+
int month = cal.get(Calendar.MONTH) + 1;
|
110
|
+
int day = cal.get(Calendar.DAY_OF_MONTH);
|
111
|
+
|
74
112
|
// TODO get default current time from ExecTask.getExecTimestamp
|
75
|
-
this.helper = (JRubyTimeParserHelper) helperFactory.newInstance(format,
|
113
|
+
this.helper = (JRubyTimeParserHelper) helperFactory.newInstance(format, year, month, day, 0, 0, 0, 0); // TODO default time zone
|
76
114
|
this.defaultTimeZone = defaultTimeZone;
|
77
115
|
}
|
78
116
|
|
@@ -60,4 +60,16 @@ public class TestTimestampFormatterParser
|
|
60
60
|
TimestampParser parser = new TimestampParser(ptask);
|
61
61
|
assertEquals(Timestamp.ofEpochSecond(1416365189), parser.parse("1416365189"));
|
62
62
|
}
|
63
|
+
|
64
|
+
@Test
|
65
|
+
public void testDefaultDate() throws Exception
|
66
|
+
{
|
67
|
+
ConfigSource config = Exec.newConfigSource()
|
68
|
+
.set("default_timestamp_format", "%H:%M:%S %Z")
|
69
|
+
.set("default_date", "2016-02-03");
|
70
|
+
|
71
|
+
ParserTestTask ptask = config.loadConfig(ParserTestTask.class);
|
72
|
+
TimestampParser parser = new TimestampParser(ptask);
|
73
|
+
assertEquals(Timestamp.ofEpochSecond(1454467589, 0), parser.parse("02:46:29 +0000"));
|
74
|
+
}
|
63
75
|
}
|
data/embulk-docs/src/release.rst
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
Release 0.8.9
|
2
|
+
==================================
|
3
|
+
|
4
|
+
General Changes
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Added ``date:`` option to timestamp parser. If format doesn't include date part, date option is used as the default date. For example, parsing text "02:46:29" with ``format: %H:%M:%S`` and ``date: 2016-02-03`` options returns "2016-02-03 02:46:29".
|
8
|
+
|
9
|
+
* Upgraded msgpack-core version from 0.8.6 to 0.8.7. Release notes of msgpack-java: https://github.com/msgpack/msgpack-java/blob/develop/RELEASE_NOTES.md
|
10
|
+
|
11
|
+
|
12
|
+
Release Date
|
13
|
+
------------------
|
14
|
+
2016-05-12
|
@@ -1 +1 @@
|
|
1
|
-
jruby-9.0.
|
1
|
+
jruby-9.0.5.0
|
data/lib/embulk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jruby-jars
|
@@ -108,9 +108,9 @@ files:
|
|
108
108
|
- classpath/commons-beanutils-core-1.8.3.jar
|
109
109
|
- classpath/commons-compress-1.10.jar
|
110
110
|
- classpath/commons-lang3-3.1.jar
|
111
|
-
- classpath/embulk-cli-0.8.
|
112
|
-
- classpath/embulk-core-0.8.
|
113
|
-
- classpath/embulk-standards-0.8.
|
111
|
+
- classpath/embulk-cli-0.8.9.jar
|
112
|
+
- classpath/embulk-core-0.8.9.jar
|
113
|
+
- classpath/embulk-standards-0.8.9.jar
|
114
114
|
- classpath/guava-18.0.jar
|
115
115
|
- classpath/guice-4.0.jar
|
116
116
|
- classpath/guice-bootstrap-0.1.1.jar
|
@@ -126,7 +126,7 @@ files:
|
|
126
126
|
- classpath/joda-time-2.9.2.jar
|
127
127
|
- classpath/logback-classic-1.1.3.jar
|
128
128
|
- classpath/logback-core-1.1.3.jar
|
129
|
-
- classpath/msgpack-core-0.8.
|
129
|
+
- classpath/msgpack-core-0.8.7.jar
|
130
130
|
- classpath/netty-buffer-5.0.0.Alpha1.jar
|
131
131
|
- classpath/netty-common-5.0.0.Alpha1.jar
|
132
132
|
- classpath/slf4j-api-1.7.12.jar
|
@@ -429,6 +429,7 @@ files:
|
|
429
429
|
- embulk-docs/src/release/release-0.8.6.rst
|
430
430
|
- embulk-docs/src/release/release-0.8.7.rst
|
431
431
|
- embulk-docs/src/release/release-0.8.8.rst
|
432
|
+
- embulk-docs/src/release/release-0.8.9.rst
|
432
433
|
- embulk-standards/build.gradle
|
433
434
|
- embulk-standards/src/main/java/org/embulk/standards/Bzip2FileDecoderPlugin.java
|
434
435
|
- embulk-standards/src/main/java/org/embulk/standards/Bzip2FileEncoderPlugin.java
|