embulk-filter-timestamp_format 0.3.1 → 0.3.2
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/.travis.yml +0 -2
- data/CHANGELOG.md +6 -0
- data/build.gradle +13 -11
- data/example/example.yml +1 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +1 -2
- data/gradlew +43 -35
- data/src/main/java/org/embulk/filter/timestamp_format/TimestampParser.java +26 -11
- data/src/test/java/org/embulk/filter/timestamp_format/TestTimestampParser.java +0 -2
- metadata +25 -25
- data/example/example.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578d0fabe6d896aedd6a07bd8c11d1cb1c81655f
|
4
|
+
data.tar.gz: 1cc1788749509ddbb3d5d15aaad28bece92c5f58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd9a00885725dd08b68a296a6c0706895075835fa05a80803e03417a32439c0fec2eef3ba223ec12f8c21e768ab8e6b2c43f3fd9bec2e3437ae6a3c14453390c
|
7
|
+
data.tar.gz: edc6d27877426d758af4cc492b07061a12d154a9b244ae71b713ff03055a9938626218d22c2e9728d08f7da77895b7f7cbadd9d63f21fc1a72caced2dfbd64a7
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
plugins {
|
2
2
|
id "com.jfrog.bintray" version "1.1"
|
3
|
-
id "com.github.jruby-gradle.base" version "
|
3
|
+
id "com.github.jruby-gradle.base" version "1.5.0"
|
4
4
|
id "java"
|
5
5
|
id "checkstyle"
|
6
6
|
}
|
@@ -13,17 +13,17 @@ configurations {
|
|
13
13
|
provided
|
14
14
|
}
|
15
15
|
|
16
|
-
version = "0.3.
|
17
|
-
sourceCompatibility = 1.
|
18
|
-
targetCompatibility = 1.
|
16
|
+
version = "0.3.2"
|
17
|
+
sourceCompatibility = 1.8
|
18
|
+
targetCompatibility = 1.8
|
19
19
|
|
20
20
|
dependencies {
|
21
|
-
compile "org.embulk:embulk-core:0.
|
22
|
-
provided "org.embulk:embulk-core:0.
|
21
|
+
compile "org.embulk:embulk-core:0.9.12"
|
22
|
+
provided "org.embulk:embulk-core:0.9.12"
|
23
23
|
compile "io.github.medjed:JsonPathCompiler:0.1.+"
|
24
24
|
|
25
25
|
testCompile "junit:junit:4.+"
|
26
|
-
testCompile "org.embulk:embulk-core:0.
|
26
|
+
testCompile "org.embulk:embulk-core:0.9.12:tests"
|
27
27
|
}
|
28
28
|
|
29
29
|
checkstyle {
|
@@ -38,14 +38,16 @@ task classpath(type: Copy, dependsOn: ["jar"]) {
|
|
38
38
|
clean { delete "classpath" }
|
39
39
|
|
40
40
|
task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
|
41
|
-
jrubyArgs "-
|
42
|
-
script "
|
41
|
+
jrubyArgs "-S"
|
42
|
+
script "gem"
|
43
|
+
scriptArgs "build", "${project.name}.gemspec"
|
43
44
|
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
|
44
45
|
}
|
45
46
|
|
46
47
|
task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
|
47
|
-
jrubyArgs "-
|
48
|
-
script "
|
48
|
+
jrubyArgs "-S"
|
49
|
+
script "gem"
|
50
|
+
scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
|
49
51
|
}
|
50
52
|
|
51
53
|
task "package"(dependsOn: ["gemspec", "classpath"]) << {
|
data/example/example.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
example/from_string.yml
|
Binary file
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#Wed Aug 09 13:08:20 JST 2017
|
2
1
|
distributionBase=GRADLE_USER_HOME
|
3
2
|
distributionPath=wrapper/dists
|
4
3
|
zipStoreBase=GRADLE_USER_HOME
|
5
4
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
5
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
|
data/gradlew
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env sh
|
2
2
|
|
3
3
|
##############################################################################
|
4
4
|
##
|
@@ -6,20 +6,38 @@
|
|
6
6
|
##
|
7
7
|
##############################################################################
|
8
8
|
|
9
|
-
#
|
10
|
-
|
9
|
+
# Attempt to set APP_HOME
|
10
|
+
# Resolve links: $0 may be a link
|
11
|
+
PRG="$0"
|
12
|
+
# Need this for relative symlinks.
|
13
|
+
while [ -h "$PRG" ] ; do
|
14
|
+
ls=`ls -ld "$PRG"`
|
15
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
16
|
+
if expr "$link" : '/.*' > /dev/null; then
|
17
|
+
PRG="$link"
|
18
|
+
else
|
19
|
+
PRG=`dirname "$PRG"`"/$link"
|
20
|
+
fi
|
21
|
+
done
|
22
|
+
SAVED="`pwd`"
|
23
|
+
cd "`dirname \"$PRG\"`/" >/dev/null
|
24
|
+
APP_HOME="`pwd -P`"
|
25
|
+
cd "$SAVED" >/dev/null
|
11
26
|
|
12
27
|
APP_NAME="Gradle"
|
13
28
|
APP_BASE_NAME=`basename "$0"`
|
14
29
|
|
30
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
31
|
+
DEFAULT_JVM_OPTS=""
|
32
|
+
|
15
33
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
16
34
|
MAX_FD="maximum"
|
17
35
|
|
18
|
-
warn (
|
36
|
+
warn () {
|
19
37
|
echo "$*"
|
20
38
|
}
|
21
39
|
|
22
|
-
die (
|
40
|
+
die () {
|
23
41
|
echo
|
24
42
|
echo "$*"
|
25
43
|
echo
|
@@ -30,6 +48,7 @@ die ( ) {
|
|
30
48
|
cygwin=false
|
31
49
|
msys=false
|
32
50
|
darwin=false
|
51
|
+
nonstop=false
|
33
52
|
case "`uname`" in
|
34
53
|
CYGWIN* )
|
35
54
|
cygwin=true
|
@@ -40,31 +59,11 @@ case "`uname`" in
|
|
40
59
|
MINGW* )
|
41
60
|
msys=true
|
42
61
|
;;
|
62
|
+
NONSTOP* )
|
63
|
+
nonstop=true
|
64
|
+
;;
|
43
65
|
esac
|
44
66
|
|
45
|
-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
46
|
-
if $cygwin ; then
|
47
|
-
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
48
|
-
fi
|
49
|
-
|
50
|
-
# Attempt to set APP_HOME
|
51
|
-
# Resolve links: $0 may be a link
|
52
|
-
PRG="$0"
|
53
|
-
# Need this for relative symlinks.
|
54
|
-
while [ -h "$PRG" ] ; do
|
55
|
-
ls=`ls -ld "$PRG"`
|
56
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
57
|
-
if expr "$link" : '/.*' > /dev/null; then
|
58
|
-
PRG="$link"
|
59
|
-
else
|
60
|
-
PRG=`dirname "$PRG"`"/$link"
|
61
|
-
fi
|
62
|
-
done
|
63
|
-
SAVED="`pwd`"
|
64
|
-
cd "`dirname \"$PRG\"`/" >&-
|
65
|
-
APP_HOME="`pwd -P`"
|
66
|
-
cd "$SAVED" >&-
|
67
|
-
|
68
67
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
69
68
|
|
70
69
|
# Determine the Java command to use to start the JVM.
|
@@ -90,7 +89,7 @@ location of your Java installation."
|
|
90
89
|
fi
|
91
90
|
|
92
91
|
# Increase the maximum file descriptors if we can.
|
93
|
-
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
92
|
+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
94
93
|
MAX_FD_LIMIT=`ulimit -H -n`
|
95
94
|
if [ $? -eq 0 ] ; then
|
96
95
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
@@ -114,6 +113,7 @@ fi
|
|
114
113
|
if $cygwin ; then
|
115
114
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
116
115
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
116
|
+
JAVACMD=`cygpath --unix "$JAVACMD"`
|
117
117
|
|
118
118
|
# We build the pattern for arguments to be converted via cygpath
|
119
119
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
@@ -154,11 +154,19 @@ if $cygwin ; then
|
|
154
154
|
esac
|
155
155
|
fi
|
156
156
|
|
157
|
-
#
|
158
|
-
|
159
|
-
|
157
|
+
# Escape application args
|
158
|
+
save () {
|
159
|
+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
160
|
+
echo " "
|
160
161
|
}
|
161
|
-
|
162
|
-
|
162
|
+
APP_ARGS=$(save "$@")
|
163
|
+
|
164
|
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
165
|
+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
166
|
+
|
167
|
+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
168
|
+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
169
|
+
cd "$(dirname "$0")"
|
170
|
+
fi
|
163
171
|
|
164
|
-
exec "$JAVACMD" "
|
172
|
+
exec "$JAVACMD" "$@"
|
@@ -7,12 +7,8 @@ import org.embulk.config.ConfigDefault;
|
|
7
7
|
|
8
8
|
import org.embulk.filter.timestamp_format.TimestampFormatFilterPlugin.PluginTask;
|
9
9
|
|
10
|
-
import org.embulk.spi.time.JRubyTimeParserHelper;
|
11
|
-
import org.embulk.spi.time.JRubyTimeParserHelperFactory;
|
12
10
|
import org.embulk.spi.time.Timestamp;
|
13
11
|
|
14
|
-
import static org.embulk.spi.time.TimestampFormat.parseDateTimeZone;
|
15
|
-
|
16
12
|
import org.embulk.spi.time.TimestampParseException;
|
17
13
|
import org.joda.time.DateTime;
|
18
14
|
import org.joda.time.DateTimeZone;
|
@@ -67,7 +63,7 @@ public class TimestampParser {
|
|
67
63
|
// TODO get default current time from ExecTask.getExecTimestamp
|
68
64
|
for (String format : formatList) {
|
69
65
|
if (format.contains("%")) {
|
70
|
-
org.embulk.spi.time.TimestampParser parser =
|
66
|
+
org.embulk.spi.time.TimestampParser parser = createTimestampParser(format, defaultFromTimeZone);
|
71
67
|
this.jrubyParserList.add(parser);
|
72
68
|
} else {
|
73
69
|
// special treatment for nano resolution. n is not originally supported by Joda-Time
|
@@ -190,6 +186,11 @@ public class TimestampParser {
|
|
190
186
|
return this.defaultTimeZone;
|
191
187
|
}
|
192
188
|
@Override
|
189
|
+
public String getDefaultTimeZoneId()
|
190
|
+
{
|
191
|
+
return this.defaultTimeZone.getID();
|
192
|
+
}
|
193
|
+
@Override
|
193
194
|
public String getDefaultTimestampFormat()
|
194
195
|
{
|
195
196
|
return this.defaultTimestampFormat;
|
@@ -199,7 +200,6 @@ public class TimestampParser {
|
|
199
200
|
{
|
200
201
|
return this.defaultDate;
|
201
202
|
}
|
202
|
-
@Override
|
203
203
|
public ScriptingContainer getJRuby()
|
204
204
|
{
|
205
205
|
return null;
|
@@ -226,6 +226,16 @@ public class TimestampParser {
|
|
226
226
|
return this.timeZone;
|
227
227
|
}
|
228
228
|
@Override
|
229
|
+
public Optional<String> getTimeZoneId()
|
230
|
+
{
|
231
|
+
if (this.timeZone.isPresent()) {
|
232
|
+
return Optional.of(this.timeZone.get().getID());
|
233
|
+
}
|
234
|
+
else {
|
235
|
+
return Optional.absent();
|
236
|
+
}
|
237
|
+
}
|
238
|
+
@Override
|
229
239
|
public Optional<String> getFormat()
|
230
240
|
{
|
231
241
|
return this.format;
|
@@ -237,12 +247,17 @@ public class TimestampParser {
|
|
237
247
|
}
|
238
248
|
}
|
239
249
|
|
240
|
-
|
250
|
+
// ToDo: Replace with `TimestampParser.of(Task, TimestampColumnOption)`
|
251
|
+
// after deciding to drop supporting embulk < 0.8.29.
|
252
|
+
private org.embulk.spi.time.TimestampParser createTimestampParser(String format, DateTimeZone timezone)
|
253
|
+
{
|
254
|
+
return createTimestampParser(format, timezone, "1970-01-01");
|
255
|
+
}
|
256
|
+
|
257
|
+
// ToDo: Replace with `TimestampParser.of(Task, TimestampColumnOption)`
|
258
|
+
// after deciding to drop supporting embulk < 0.8.29.
|
259
|
+
private org.embulk.spi.time.TimestampParser createTimestampParser(String format, DateTimeZone timezone, String date)
|
241
260
|
{
|
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
261
|
TimestampParserTaskImpl task = new TimestampParserTaskImpl(timezone, format, date);
|
247
262
|
TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
|
248
263
|
Optional.of(timezone), Optional.of(format), Optional.of(date));
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
|
-
- - ~>
|
16
|
+
- - "~>"
|
23
17
|
- !ruby/object:Gem::Version
|
24
18
|
version: '1.0'
|
19
|
+
name: bundler
|
25
20
|
prerelease: false
|
26
21
|
type: :development
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
|
-
- -
|
24
|
+
- - "~>"
|
32
25
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
|
-
- -
|
30
|
+
- - ">="
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: '10.0'
|
33
|
+
name: rake
|
39
34
|
prerelease: false
|
40
35
|
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
41
|
description: A filter plugin for Embulk to change timestamp format.
|
42
42
|
email:
|
43
43
|
- sonots@gmail.com
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- CHANGELOG.md
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -57,6 +57,12 @@ files:
|
|
57
57
|
- bench/config_nano.yml
|
58
58
|
- bench/gen_dummy.rb
|
59
59
|
- build.gradle
|
60
|
+
- classpath/JsonPathCompiler-0.1.2.jar
|
61
|
+
- classpath/accessors-smart-1.1.jar
|
62
|
+
- classpath/asm-5.0.3.jar
|
63
|
+
- classpath/embulk-filter-timestamp_format-0.3.2.jar
|
64
|
+
- classpath/json-smart-2.2.1.jar
|
65
|
+
- classpath/slf4j-api-1.7.21.jar
|
60
66
|
- config/checkstyle/checkstyle.xml
|
61
67
|
- example/bracket_notation.txt
|
62
68
|
- example/bracket_notation.yml
|
@@ -108,12 +114,6 @@ files:
|
|
108
114
|
- src/test/java/org/embulk/filter/timestamp_format/TestTimestampFormatConverter.java
|
109
115
|
- src/test/java/org/embulk/filter/timestamp_format/TestTimestampParser.java
|
110
116
|
- src/test/java/org/embulk/filter/timestamp_format/TestTimestampUnit.java
|
111
|
-
- classpath/accessors-smart-1.1.jar
|
112
|
-
- classpath/asm-5.0.3.jar
|
113
|
-
- classpath/embulk-filter-timestamp_format-0.3.1.jar
|
114
|
-
- classpath/json-smart-2.2.1.jar
|
115
|
-
- classpath/JsonPathCompiler-0.1.2.jar
|
116
|
-
- classpath/slf4j-api-1.7.21.jar
|
117
117
|
homepage: https://github.com/sonots/embulk-filter-timestamp_format
|
118
118
|
licenses:
|
119
119
|
- MIT
|
@@ -124,17 +124,17 @@ require_paths:
|
|
124
124
|
- lib
|
125
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- -
|
132
|
+
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.6.8
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: A filter plugin for Embulk to change timestamp format
|
data/example/example.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
in:
|
2
|
-
type: file
|
3
|
-
path_prefix: example/from_string.csv
|
4
|
-
parser:
|
5
|
-
type: csv
|
6
|
-
columns:
|
7
|
-
- {name: string1, type: string}
|
8
|
-
- {name: string2, type: string}
|
9
|
-
- {name: string3, type: string}
|
10
|
-
- {name: string4, type: string}
|
11
|
-
- {name: record, type: json}
|
12
|
-
filters:
|
13
|
-
- type: timestamp_format
|
14
|
-
default_from_timezone: "Asia/Taipei"
|
15
|
-
default_from_timestamp_format: ["%Y-%m-%d %H:%M:%S.%N %z", "%Y-%m-%d %H:%M:%S %z", "%Y-%m-%d %H:%M:%S", "%Y-%m-%d %z", "%Y-%m-%d"]
|
16
|
-
default_to_timezone: "Asia/Taipei"
|
17
|
-
default_to_timestamp_format: "%Y-%m-%d %H:%M:%S.%N"
|
18
|
-
columns:
|
19
|
-
- {name: string1, type: string}
|
20
|
-
- {name: string2, type: long, to_unit: ms}
|
21
|
-
- {name: string3, type: double, to_unit: ms}
|
22
|
-
- {name: string4, type: timestamp}
|
23
|
-
- {name: $.record.string1, to_timezone: "Asia/Taipei", to_format: "%Y-%m-%d %H:%M:%S.%N"}
|
24
|
-
- {name: $.record.string2, type: long, to_unit: ms}
|
25
|
-
- {name: $.record.string3, type: double, to_unit: ms}
|
26
|
-
out:
|
27
|
-
type: "null"
|