embulk 0.8.6-java → 0.8.7-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/build.gradle +4 -4
- data/embulk-core/src/main/java/org/embulk/config/TaskSerDe.java +9 -5
- data/embulk-core/src/main/java/org/embulk/spi/util/LineDecoder.java +41 -2
- data/embulk-docs/src/release.rst +1 -0
- data/embulk-docs/src/release/release-0.8.7.rst +18 -0
- data/lib/embulk/guess/time_format_guess.rb +26 -10
- data/lib/embulk/schema.rb +1 -0
- data/lib/embulk/version.rb +1 -1
- data/test/guess/test_time_format_guess.rb +11 -9
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98e039789becbcef42f963168643948f707edded
|
4
|
+
data.tar.gz: f688c2bf0e9a22fbbf91225e59eb30d5227e0f96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335aec08490a828d9d48bc320ef0271cbfd27766919976260f87a14ff7d7b966d8ab5639b224a2eacbc767295e0fa157b78126c836345b13d3ae0f51ff0d3c17
|
7
|
+
data.tar.gz: 81eff9b4d4fe077bdd3ff84428a167ef9fea7118f3c229e2cee6d667e68d652ac0f03f63eab706d48e7198d413af7a3d202b034f232192d151142632f97b9967
|
data/build.gradle
CHANGED
@@ -16,7 +16,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards")]
|
|
16
16
|
|
17
17
|
allprojects {
|
18
18
|
group = 'org.embulk'
|
19
|
-
version = '0.8.
|
19
|
+
version = '0.8.7'
|
20
20
|
|
21
21
|
ext {
|
22
22
|
jrubyVersion = '9.0.5.0'
|
@@ -232,10 +232,10 @@ project(':embulk-cli') {
|
|
232
232
|
append("${rootProject.projectDir}/COPYING")
|
233
233
|
}
|
234
234
|
|
235
|
-
task classpath(type: Copy) {
|
235
|
+
task classpath(type: Copy, dependsOn: ['jar']) {
|
236
236
|
File dest = file("${rootProject.projectDir}/classpath")
|
237
237
|
doFirst { dest.deleteDir() }
|
238
|
-
from configurations.runtime
|
238
|
+
from configurations.runtime + files("${project.libsDir}/${project.name}-${project.version}.jar")
|
239
239
|
into dest
|
240
240
|
}
|
241
241
|
}
|
@@ -300,7 +300,7 @@ task releaseCheck << {
|
|
300
300
|
println "Ready. Run 'release' task."
|
301
301
|
}
|
302
302
|
|
303
|
-
task release(dependsOn: ["releaseCheck", "bintrayUpload", "rubyGemsUpload"]) << {
|
303
|
+
task release(dependsOn: ["cli", "releaseCheck", "bintrayUpload", "rubyGemsUpload"]) << {
|
304
304
|
println """
|
305
305
|
Manual operations:
|
306
306
|
|
@@ -142,14 +142,18 @@ class TaskSerDe
|
|
142
142
|
Map<String, Object> objects = new ConcurrentHashMap<String, Object>();
|
143
143
|
HashMap<String, FieldEntry> unusedMappings = new HashMap<>(mappings);
|
144
144
|
|
145
|
-
|
146
|
-
current = jp.getCurrentToken();
|
145
|
+
String key;
|
146
|
+
JsonToken current = jp.getCurrentToken();
|
147
147
|
if (current == JsonToken.START_OBJECT) {
|
148
148
|
current = jp.nextToken();
|
149
|
+
key = jp.getCurrentName();
|
149
150
|
}
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
else {
|
152
|
+
key = jp.nextFieldName();
|
153
|
+
}
|
154
|
+
|
155
|
+
for (; key != null; key = jp.nextFieldName()) {
|
156
|
+
JsonToken t = jp.nextToken(); // to get to value
|
153
157
|
FieldEntry field = mappings.get(key);
|
154
158
|
if (field == null) {
|
155
159
|
jp.skipChildren();
|
@@ -13,6 +13,7 @@ import org.embulk.config.Task;
|
|
13
13
|
import org.embulk.config.Config;
|
14
14
|
import org.embulk.config.ConfigDefault;
|
15
15
|
import org.embulk.spi.FileInput;
|
16
|
+
import static java.nio.charset.StandardCharsets.UTF_8;
|
16
17
|
|
17
18
|
public class LineDecoder
|
18
19
|
implements AutoCloseable, Iterable<String>
|
@@ -33,10 +34,12 @@ public class LineDecoder
|
|
33
34
|
|
34
35
|
private final FileInputInputStream inputStream;
|
35
36
|
private final BufferedReader reader;
|
37
|
+
private final Charset charset;
|
36
38
|
|
37
39
|
public LineDecoder(FileInput in, DecoderTask task)
|
38
40
|
{
|
39
|
-
|
41
|
+
this.charset = task.getCharset();
|
42
|
+
CharsetDecoder decoder = charset
|
40
43
|
.newDecoder()
|
41
44
|
.onMalformedInput(CodingErrorAction.REPLACE) // TODO configurable?
|
42
45
|
.onUnmappableCharacter(CodingErrorAction.REPLACE); // TODO configurable?
|
@@ -46,7 +49,43 @@ public class LineDecoder
|
|
46
49
|
|
47
50
|
public boolean nextFile()
|
48
51
|
{
|
49
|
-
|
52
|
+
boolean has = inputStream.nextFile();
|
53
|
+
if (has && charset.equals(UTF_8)) {
|
54
|
+
skipBom();
|
55
|
+
}
|
56
|
+
return has;
|
57
|
+
}
|
58
|
+
|
59
|
+
private void skipBom()
|
60
|
+
{
|
61
|
+
boolean skip = false;
|
62
|
+
try {
|
63
|
+
if (charset.equals(UTF_8)) {
|
64
|
+
reader.mark(3);
|
65
|
+
int firstChar = reader.read();
|
66
|
+
if (firstChar == 0xFEFF) {
|
67
|
+
// skip BOM bytes
|
68
|
+
skip = true;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
catch (IOException ex) {
|
73
|
+
}
|
74
|
+
finally {
|
75
|
+
if (skip) {
|
76
|
+
// firstChar is skipped
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
// rollback to the marked position
|
80
|
+
try {
|
81
|
+
reader.reset();
|
82
|
+
}
|
83
|
+
catch (IOException ex) {
|
84
|
+
// unexpected
|
85
|
+
throw new RuntimeException(ex);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
50
89
|
}
|
51
90
|
|
52
91
|
public String poll()
|
data/embulk-docs/src/release.rst
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
Release 0.8.7
|
2
|
+
==================================
|
3
|
+
|
4
|
+
General Changes
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* LineDecoder skips UTF-8 BOM appropriately.
|
8
|
+
|
9
|
+
* Timestamp guess uses ``%z`` instead of ``%Z``. Parsing behavior doesn't change but formatting behavior changes if output plugins use guessed configuration to format timestamp (this is unlikely because guessed configuration is most likely used by input plugins to parse timestamp).
|
10
|
+
|
11
|
+
* Fix uninitialized constant MessagePack (@sonots++)
|
12
|
+
|
13
|
+
* Fixed a possible busy loop at TaskDeserializer.
|
14
|
+
|
15
|
+
|
16
|
+
Release Date
|
17
|
+
------------------
|
18
|
+
2016-03-04
|
@@ -107,11 +107,15 @@ module Embulk::Guess
|
|
107
107
|
format << '%N'
|
108
108
|
end
|
109
109
|
|
110
|
-
when :
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
when :zone
|
111
|
+
case option
|
112
|
+
when :extended
|
113
|
+
format << '%:z'
|
114
|
+
else
|
115
|
+
# :simple, :abb
|
116
|
+
# don't use %Z even with :abb: https://github.com/jruby/jruby/issues/3702
|
117
|
+
format << '%z'
|
118
|
+
end
|
115
119
|
|
116
120
|
else
|
117
121
|
raise "Unknown part: #{@parts[i]}"
|
@@ -275,12 +279,16 @@ module Embulk::Guess
|
|
275
279
|
|
276
280
|
if zm = /^#{ZONE}$/.match(rest)
|
277
281
|
delimiters << (zm["zone_space"] || '')
|
282
|
+
parts << :zone
|
278
283
|
if zm["zone_off"]
|
279
|
-
|
284
|
+
if zm["zone_off"].include?(':')
|
285
|
+
part_options << :extended
|
286
|
+
else
|
287
|
+
part_options << :simple
|
288
|
+
end
|
280
289
|
else
|
281
|
-
|
290
|
+
part_options << :abb
|
282
291
|
end
|
283
|
-
part_options << nil
|
284
292
|
|
285
293
|
return GuessMatch.new(delimiters, parts, part_options)
|
286
294
|
|
@@ -334,8 +342,16 @@ module Embulk::Guess
|
|
334
342
|
format << "%d %b %Y"
|
335
343
|
format << " %H:%M" if m['time']
|
336
344
|
format << ":%S" if m['second']
|
337
|
-
|
338
|
-
|
345
|
+
if m['zone_off']
|
346
|
+
if m['zone_off'].include?(':')
|
347
|
+
format << " %:z"
|
348
|
+
else
|
349
|
+
format << " %z"
|
350
|
+
end
|
351
|
+
elsif m['zone_abb']
|
352
|
+
# don't use %Z: https://github.com/jruby/jruby/issues/3702
|
353
|
+
format << " %z" if m['zone_abb']
|
354
|
+
end
|
339
355
|
SimpleMatch.new(format)
|
340
356
|
else
|
341
357
|
nil
|
data/lib/embulk/schema.rb
CHANGED
data/lib/embulk/version.rb
CHANGED
@@ -66,24 +66,25 @@ class TimeFormatGuessTest < ::Test::Unit::TestCase
|
|
66
66
|
assert_guess "%Y-%m-%dT%H:%M:%S", "2007-04-06T13:47:30"
|
67
67
|
assert_guess "%Y-%m-%dT%H:%M:%S%z", "2007-04-06T13:47:30Z"
|
68
68
|
assert_guess "%Y-%m-%dT%H:%M:%S%z", "2007-04-06T13:47:30+00"
|
69
|
-
assert_guess "%Y-%m-%dT%H:%M:%S
|
69
|
+
assert_guess "%Y-%m-%dT%H:%M:%S%:z", "2007-04-06T13:47:30+00:00"
|
70
70
|
assert_guess "%Y-%m-%dT%H:%M:%S%z", "2007-04-06T13:47:30+0000"
|
71
71
|
assert_guess "%Y-%m-%dT%H:%M:%S%z", "2007-04-06T13:47:30-01"
|
72
|
-
assert_guess "%Y-%m-%dT%H:%M:%S
|
72
|
+
assert_guess "%Y-%m-%dT%H:%M:%S%:z", "2007-04-06T13:47:30-01:30"
|
73
73
|
assert_guess "%Y-%m-%dT%H:%M:%S%z", "2007-04-06T13:47:30-0130"
|
74
74
|
end
|
75
75
|
|
76
76
|
def test_format_rfc_822_2822
|
77
|
-
|
78
|
-
assert_guess '%a, %d %b %Y %H:%M:%S %Z', "Fri, 20 Feb 2015
|
79
|
-
assert_guess '%a, %d %b %Y %H:%M:%S %
|
80
|
-
assert_guess
|
81
|
-
assert_guess '%d %b %Y %H:%M %
|
82
|
-
assert_guess
|
77
|
+
# This test is disabled because of https://github.com/jruby/jruby/issues/3702
|
78
|
+
#assert_guess '%a, %d %b %Y %H:%M:%S %Z', "Fri, 20 Feb 2015 14:02:34 PST"
|
79
|
+
assert_guess '%a, %d %b %Y %H:%M:%S %z', "Fri, 20 Feb 2015 22:02:34 UT"
|
80
|
+
assert_guess '%a, %d %b %Y %H:%M:%S %z', "Fri, 20 Feb 2015 22:02:34 GMT"
|
81
|
+
assert_guess '%d %b %Y %H:%M:%S %z', "20 Feb 2015 22:02:34 GMT"
|
82
|
+
assert_guess '%d %b %Y %H:%M %z', "20 Feb 2015 22:02 GMT"
|
83
|
+
assert_guess '%a, %d %b %Y %H:%M %z', "Fri, 20 Feb 2015 22:02 GMT"
|
83
84
|
assert_guess '%d %b %Y', "20 Feb 2015"
|
84
85
|
assert_guess '%a, %d %b %Y', "Fri, 20 Feb 2015"
|
85
86
|
assert_guess '%a, %d %b %Y %H:%M %z', "Fri, 20 Feb 2015 22:02 +0000"
|
86
|
-
assert_guess '%a, %d %b %Y %H:%M
|
87
|
+
assert_guess '%a, %d %b %Y %H:%M %:z', "Fri, 20 Feb 2015 22:02 +00:00"
|
87
88
|
assert_guess '%a, %d %b %Y %H:%M %z', "Fri, 20 Feb 2015 22:02 +00"
|
88
89
|
end
|
89
90
|
|
@@ -97,6 +98,7 @@ class TimeFormatGuessTest < ::Test::Unit::TestCase
|
|
97
98
|
|
98
99
|
def test_format_merge_frequency
|
99
100
|
assert_guess_partial 2, "%Y-%m-%d %H:%M:%S", ["2014-01-01", "2014-01-01 00:00:00", "2014-01-01 00:00:00"]
|
101
|
+
assert_guess_partial 3, "%Y-%m-%d %H:%M:%S %z", ["2014-01-01 00:00:00 +0000", "2014-01-01 00:00:00 +0000", "2014-01-01 00:00:00 +00:00"]
|
100
102
|
end
|
101
103
|
|
102
104
|
def test_format_merge_dmy
|
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.7
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,8 +148,9 @@ files:
|
|
148
148
|
- classpath/commons-beanutils-core-1.8.3.jar
|
149
149
|
- classpath/commons-compress-1.10.jar
|
150
150
|
- classpath/commons-lang3-3.1.jar
|
151
|
-
- classpath/embulk-
|
152
|
-
- classpath/embulk-
|
151
|
+
- classpath/embulk-cli-0.8.7.jar
|
152
|
+
- classpath/embulk-core-0.8.7.jar
|
153
|
+
- classpath/embulk-standards-0.8.7.jar
|
153
154
|
- classpath/guava-18.0.jar
|
154
155
|
- classpath/guice-4.0.jar
|
155
156
|
- classpath/guice-bootstrap-0.1.1.jar
|
@@ -466,6 +467,7 @@ files:
|
|
466
467
|
- embulk-docs/src/release/release-0.8.4.rst
|
467
468
|
- embulk-docs/src/release/release-0.8.5.rst
|
468
469
|
- embulk-docs/src/release/release-0.8.6.rst
|
470
|
+
- embulk-docs/src/release/release-0.8.7.rst
|
469
471
|
- embulk-standards/build.gradle
|
470
472
|
- embulk-standards/src/main/java/org/embulk/standards/Bzip2FileDecoderPlugin.java
|
471
473
|
- embulk-standards/src/main/java/org/embulk/standards/Bzip2FileEncoderPlugin.java
|