embulk-filter-typecast 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1c1a4e112a53e015c9c9a42d0c1c696fbc5171a
4
- data.tar.gz: 625666a86b20a2d45e120eabd5eda2a2d6256e2e
3
+ metadata.gz: 660f8d578af9db2a6c6e2b0c12a64d4cc5774e0d
4
+ data.tar.gz: 790fd3279220f52395a135fb13d713e8223950b5
5
5
  SHA512:
6
- metadata.gz: 6c462c39a5444702970b6373f6935f665cce915fd57cb0b104013f1f4f407a777e071ad5a7a1cde7ca47e13ee94770be9a1fa497d1c67378ad4071e50bc74b07
7
- data.tar.gz: 0a12fe293a6205cc90028c5c9efd87222d2a0cd3b1a037c9630f287d1b398b5473df0c7649596ab334e1ee65d6e70ab06703151af02ef23e1454394c7467c9be
6
+ metadata.gz: 24b4d13343b8ceaf5f56d3998f2abc98f3c23da8f1011870191021e1c2f61a2c08b92e4c14bbb0a4d6dcd4bd3b6324c8aef70bf480d7a96a83b3ec6c4e4934c6
7
+ data.tar.gz: 628eb7e4b885356a53becf47fc6aa9b2176856c0e1ee7b5ed80a40a4eb25e12b072af9e616ff6af524c892ac48e48a53c0e3ba66cad3ade930b42d9fd9722153
@@ -1,7 +1,5 @@
1
1
  language: java
2
2
  jdk:
3
- - openjdk7
4
- - oraclejdk7
5
3
  - oraclejdk8
6
4
  script:
7
5
  - ./gradlew test
@@ -1,3 +1,9 @@
1
+ # 0.2.2 (2019-01-16)
2
+
3
+ Enhancements:
4
+
5
+ * Support embulk >= 0.9.0 (thanks to @hiroyuki-sato)
6
+
1
7
  # 0.2.1 (2017-08-26)
2
8
 
3
9
  Enhancements:
@@ -1,6 +1,6 @@
1
1
  plugins {
2
2
  id "com.jfrog.bintray" version "1.1"
3
- id "com.github.jruby-gradle.base" version "0.1.5"
3
+ id "com.github.jruby-gradle.base" version "1.5.0"
4
4
  id "java"
5
5
  id "checkstyle"
6
6
  }
@@ -13,18 +13,18 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.2.1"
17
- sourceCompatibility = 1.7
18
- targetCompatibility = 1.7
16
+ version = "0.2.2"
17
+ sourceCompatibility = 1.8
18
+ targetCompatibility = 1.8
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.9.12"
22
+ provided "org.embulk:embulk-core:0.9.12"
23
23
  compile "io.github.medjed:JsonPathCompiler:0.1.1"
24
24
 
25
25
  testCompile "junit:junit:4.+"
26
- testCompile "org.embulk:embulk-core:0.8.+:tests"
27
- testCompile "org.embulk:embulk-standards:0.8.+"
26
+ testCompile "org.embulk:embulk-core:0.9.12:tests"
27
+ testCompile "org.embulk:embulk-standards:0.9.12"
28
28
  }
29
29
 
30
30
  checkstyle {
@@ -39,14 +39,16 @@ task classpath(type: Copy, dependsOn: ["jar"]) {
39
39
  clean { delete "classpath" }
40
40
 
41
41
  task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
42
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
43
- script "${project.name}.gemspec"
42
+ jrubyArgs "-S"
43
+ script "gem"
44
+ scriptArgs "build", "${project.name}.gemspec"
44
45
  doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
45
46
  }
46
47
 
47
48
  task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
48
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
49
- script "pkg/${project.name}-${project.version}.gem"
49
+ jrubyArgs "-S"
50
+ script "gem"
51
+ scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
50
52
  }
51
53
 
52
54
  task "package"(dependsOn: ["gemspec", "classpath"]) << {
@@ -0,0 +1 @@
1
+ example/from_string.yml
@@ -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-3.3-all.zip
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
data/gradlew CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env sh
2
2
 
3
3
  ##############################################################################
4
4
  ##
@@ -6,20 +6,38 @@
6
6
  ##
7
7
  ##############################################################################
8
8
 
9
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
- DEFAULT_JVM_OPTS=""
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
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
- function splitJvmOpts() {
159
- JVM_OPTS=("$@")
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
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
- JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
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" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172
+ exec "$JAVACMD" "$@"
@@ -29,7 +29,6 @@ import org.embulk.spi.type.StringType;
29
29
  import org.embulk.spi.type.TimestampType;
30
30
  import org.embulk.spi.type.Type;
31
31
  import org.joda.time.DateTimeZone;
32
- import org.jruby.embed.ScriptingContainer;
33
32
  import org.msgpack.value.Value;
34
33
 
35
34
  import org.slf4j.Logger;
@@ -71,7 +70,7 @@ class ColumnCaster
71
70
  }
72
71
  Column inputColumn = inputSchema.lookupColumn(columnConfig.getName());
73
72
  if (inputColumn.getType() instanceof StringType && columnConfig.getType() instanceof TimestampType) {
74
- TimestampParser parser = getTimestampParser(task, columnConfig);
73
+ TimestampParser parser = createTimestampParser(task, columnConfig);
75
74
  this.timestampParserMap.put(columnConfig.getName(), parser);
76
75
  }
77
76
  }
@@ -86,159 +85,12 @@ class ColumnCaster
86
85
  }
87
86
  Column inputColumn = inputSchema.lookupColumn(columnConfig.getName());
88
87
  if (inputColumn.getType() instanceof TimestampType && columnConfig.getType() instanceof StringType) {
89
- TimestampFormatter parser = getTimestampFormatter(task, columnConfig);
88
+ TimestampFormatter parser = createTimestampFormatter(task, columnConfig);
90
89
  this.timestampFormatterMap.put(columnConfig.getName(), parser);
91
90
  }
92
91
  }
93
92
  }
94
93
 
95
- private class TimestampParserTaskImpl implements TimestampParser.Task
96
- {
97
- private final DateTimeZone defaultTimeZone;
98
- private final String defaultTimestampFormat;
99
- private final String defaultDate;
100
- public TimestampParserTaskImpl(
101
- DateTimeZone defaultTimeZone,
102
- String defaultTimestampFormat,
103
- String defaultDate)
104
- {
105
- this.defaultTimeZone = defaultTimeZone;
106
- this.defaultTimestampFormat = defaultTimestampFormat;
107
- this.defaultDate = defaultDate;
108
- }
109
- @Override
110
- public DateTimeZone getDefaultTimeZone()
111
- {
112
- return this.defaultTimeZone;
113
- }
114
- @Override
115
- public String getDefaultTimestampFormat()
116
- {
117
- return this.defaultTimestampFormat;
118
- }
119
- @Override
120
- public String getDefaultDate()
121
- {
122
- return this.defaultDate;
123
- }
124
- @Override
125
- public ScriptingContainer getJRuby()
126
- {
127
- return null;
128
- }
129
- }
130
-
131
- private class TimestampParserColumnOptionImpl implements TimestampParser.TimestampColumnOption
132
- {
133
- private final Optional<DateTimeZone> timeZone;
134
- private final Optional<String> format;
135
- private final Optional<String> date;
136
- public TimestampParserColumnOptionImpl(
137
- Optional<DateTimeZone> timeZone,
138
- Optional<String> format,
139
- Optional<String> date)
140
- {
141
- this.timeZone = timeZone;
142
- this.format = format;
143
- this.date = date;
144
- }
145
- @Override
146
- public Optional<DateTimeZone> getTimeZone()
147
- {
148
- return this.timeZone;
149
- }
150
- @Override
151
- public Optional<String> getFormat()
152
- {
153
- return this.format;
154
- }
155
- @Override
156
- public Optional<String> getDate()
157
- {
158
- return this.date;
159
- }
160
- }
161
-
162
- private class TimestampFormatterTaskImpl implements TimestampFormatter.Task
163
- {
164
- private final DateTimeZone defaultTimeZone;
165
- private final String defaultTimestampFormat;
166
- public TimestampFormatterTaskImpl(
167
- DateTimeZone defaultTimeZone,
168
- String defaultTimestampFormat)
169
- {
170
- this.defaultTimeZone = defaultTimeZone;
171
- this.defaultTimestampFormat = defaultTimestampFormat;
172
- }
173
- @Override
174
- public DateTimeZone getDefaultTimeZone()
175
- {
176
- return this.defaultTimeZone;
177
- }
178
- @Override
179
- public String getDefaultTimestampFormat()
180
- {
181
- return this.defaultTimestampFormat;
182
- }
183
- @Override
184
- public ScriptingContainer getJRuby()
185
- {
186
- return null;
187
- }
188
- }
189
-
190
- private class TimestampFormatterColumnOptionImpl implements TimestampFormatter.TimestampColumnOption
191
- {
192
- private final Optional<DateTimeZone> timeZone;
193
- private final Optional<String> format;
194
- public TimestampFormatterColumnOptionImpl(
195
- Optional<DateTimeZone> timeZone,
196
- Optional<String> format)
197
- {
198
- this.timeZone = timeZone;
199
- this.format = format;
200
- }
201
- @Override
202
- public Optional<DateTimeZone> getTimeZone()
203
- {
204
- return this.timeZone;
205
- }
206
- @Override
207
- public Optional<String> getFormat()
208
- {
209
- return this.format;
210
- }
211
- }
212
-
213
- private TimestampParser getTimestampParser(PluginTask task, ColumnConfig columnConfig)
214
- {
215
- // ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
216
- //
217
- // DateTimeZone timezone = columnConfig.getTimeZone().or(task.getDefaultTimeZone());
218
- // String format = columnConfig.getFormat().or(task.getDefaultTimestampFormat());
219
- // String date = columnConfig.getDate().or(task.getDefaultDate());
220
- // return new TimestampParser(format, timezone, date);
221
- TimestampParserTaskImpl t = new TimestampParserTaskImpl(
222
- task.getDefaultTimeZone(), task.getDefaultTimestampFormat(), task.getDefaultDate());
223
- TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
224
- columnConfig.getTimeZone(), columnConfig.getFormat(), columnConfig.getDate());
225
- return new TimestampParser(t, columnOption);
226
- }
227
-
228
- private TimestampFormatter getTimestampFormatter(PluginTask task, ColumnConfig columnConfig)
229
- {
230
- // ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
231
- //
232
- // String format = columnConfig.getFormat().or(task.getDefaultTimestampFormat());
233
- // DateTimeZone timezone = columnConfig.getTimeZone().or(task.getDefaultTimeZone());
234
- // return new TimestampFormatter(format, timezone);
235
- TimestampFormatterTaskImpl t = new TimestampFormatterTaskImpl(
236
- task.getDefaultTimeZone(), task.getDefaultTimestampFormat());
237
- TimestampFormatterColumnOptionImpl columnOption = new TimestampFormatterColumnOptionImpl(
238
- columnConfig.getTimeZone(), columnConfig.getFormat());
239
- return new TimestampFormatter(t, Optional.of(columnOption));
240
- }
241
-
242
94
  public void setFromBoolean(Column outputColumn, boolean value)
243
95
  {
244
96
  Type outputType = outputColumn.getType();
@@ -403,4 +255,184 @@ class ColumnCaster
403
255
  assert false;
404
256
  }
405
257
  }
258
+
259
+ private TimestampFormatter createTimestampFormatter(PluginTask task, ColumnConfig columnConfig)
260
+ {
261
+ String format = columnConfig.getFormat().or(task.getDefaultTimestampFormat());
262
+ DateTimeZone timezone = columnConfig.getTimeZone().or(task.getDefaultTimeZone());
263
+ return createTimestampFormatter(format, timezone);
264
+ }
265
+
266
+ private TimestampParser createTimestampParser(PluginTask task, ColumnConfig columnConfig)
267
+ {
268
+ DateTimeZone timezone = columnConfig.getTimeZone().or(task.getDefaultTimeZone());
269
+ String format = columnConfig.getFormat().or(task.getDefaultTimestampFormat());
270
+ String date = columnConfig.getDate().or(task.getDefaultDate());
271
+ return createTimestampParser(format, timezone, date);
272
+ }
273
+
274
+ private class TimestampFormatterTaskImpl implements TimestampFormatter.Task
275
+ {
276
+ private final DateTimeZone defaultTimeZone;
277
+ private final String defaultTimestampFormat;
278
+ public TimestampFormatterTaskImpl(
279
+ DateTimeZone defaultTimeZone,
280
+ String defaultTimestampFormat)
281
+ {
282
+ this.defaultTimeZone = defaultTimeZone;
283
+ this.defaultTimestampFormat = defaultTimestampFormat;
284
+ }
285
+ @Override
286
+ public DateTimeZone getDefaultTimeZone()
287
+ {
288
+ return this.defaultTimeZone;
289
+ }
290
+ @Override
291
+ public String getDefaultTimeZoneId()
292
+ {
293
+ return this.defaultTimeZone.getID();
294
+ }
295
+ @Override
296
+ public String getDefaultTimestampFormat()
297
+ {
298
+ return this.defaultTimestampFormat;
299
+ }
300
+ }
301
+
302
+ private class TimestampFormatterColumnOptionImpl implements TimestampFormatter.TimestampColumnOption
303
+ {
304
+ private final Optional<DateTimeZone> timeZone;
305
+ private final Optional<String> format;
306
+ public TimestampFormatterColumnOptionImpl(
307
+ Optional<DateTimeZone> timeZone,
308
+ Optional<String> format)
309
+ {
310
+ this.timeZone = timeZone;
311
+ this.format = format;
312
+ }
313
+ @Override
314
+ public Optional<DateTimeZone> getTimeZone()
315
+ {
316
+ return this.timeZone;
317
+ }
318
+ @Override
319
+ public Optional<String> getFormat()
320
+ {
321
+ return this.format;
322
+ }
323
+ @Override
324
+ public Optional<String> getTimeZoneId()
325
+ {
326
+ if (this.timeZone.isPresent()) {
327
+ return Optional.of(this.timeZone.get().getID());
328
+ }
329
+ else {
330
+ return Optional.absent();
331
+ }
332
+ }
333
+ }
334
+
335
+ // ToDo: Replace with `TimestampFormatter.of(Task, TimestampColumnOption)`
336
+ // after deciding to drop supporting embulk < 0.8.29.
337
+ private TimestampFormatter createTimestampFormatter(String format, DateTimeZone timezone)
338
+ {
339
+ TimestampFormatterTaskImpl task = new TimestampFormatterTaskImpl(timezone, format);
340
+ TimestampFormatterColumnOptionImpl columnOption = new TimestampFormatterColumnOptionImpl(
341
+ Optional.of(timezone), Optional.of(format));
342
+ return new TimestampFormatter(task, Optional.of(columnOption));
343
+ }
344
+
345
+ private class TimestampParserTaskImpl implements TimestampParser.Task
346
+ {
347
+ private final DateTimeZone defaultTimeZone;
348
+ private final String defaultTimestampFormat;
349
+ private final String defaultDate;
350
+ public TimestampParserTaskImpl(
351
+ DateTimeZone defaultTimeZone,
352
+ String defaultTimestampFormat,
353
+ String defaultDate)
354
+ {
355
+ this.defaultTimeZone = defaultTimeZone;
356
+ this.defaultTimestampFormat = defaultTimestampFormat;
357
+ this.defaultDate = defaultDate;
358
+ }
359
+ @Override
360
+ public DateTimeZone getDefaultTimeZone()
361
+ {
362
+ return this.defaultTimeZone;
363
+ }
364
+ @Override
365
+ public String getDefaultTimeZoneId()
366
+ {
367
+ return this.defaultTimeZone.getID();
368
+ }
369
+ @Override
370
+ public String getDefaultTimestampFormat()
371
+ {
372
+ return this.defaultTimestampFormat;
373
+ }
374
+ @Override
375
+ public String getDefaultDate()
376
+ {
377
+ return this.defaultDate;
378
+ }
379
+ }
380
+
381
+ private class TimestampParserColumnOptionImpl implements TimestampParser.TimestampColumnOption
382
+ {
383
+ private final Optional<DateTimeZone> timeZone;
384
+ private final Optional<String> format;
385
+ private final Optional<String> date;
386
+ public TimestampParserColumnOptionImpl(
387
+ Optional<DateTimeZone> timeZone,
388
+ Optional<String> format,
389
+ Optional<String> date)
390
+ {
391
+ this.timeZone = timeZone;
392
+ this.format = format;
393
+ this.date = date;
394
+ }
395
+ @Override
396
+ public Optional<DateTimeZone> getTimeZone()
397
+ {
398
+ return this.timeZone;
399
+ }
400
+ @Override
401
+ public Optional<String> getFormat()
402
+ {
403
+ return this.format;
404
+ }
405
+ @Override
406
+ public Optional<String> getDate()
407
+ {
408
+ return this.date;
409
+ }
410
+ @Override
411
+ public Optional<String> getTimeZoneId()
412
+ {
413
+ if (this.timeZone.isPresent()) {
414
+ return Optional.of(this.timeZone.get().getID());
415
+ }
416
+ else {
417
+ return Optional.absent();
418
+ }
419
+ }
420
+ }
421
+
422
+ // ToDo: Replace with `TimestampParser.of(Task, TimestampColumnOption)`
423
+ // after deciding to drop supporting embulk < 0.8.29.
424
+ private TimestampParser createTimestampParser(String format, DateTimeZone timezone)
425
+ {
426
+ return createTimestampParser(format, timezone, "1970-01-01");
427
+ }
428
+
429
+ // ToDo: Replace with `TimestampParser.of(Task, TimestampColumnOption)`
430
+ // after deciding to drop supporting embulk < 0.8.29.
431
+ private TimestampParser createTimestampParser(String format, DateTimeZone timezone, String date)
432
+ {
433
+ TimestampParserTaskImpl task = new TimestampParserTaskImpl(timezone, format, date);
434
+ TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
435
+ Optional.of(timezone), Optional.of(format), Optional.of(date));
436
+ return new TimestampParser(task, columnOption);
437
+ }
406
438
  }
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-typecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.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: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2019-01-16 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: '10.0'
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 cast column type.
42
42
  email:
43
43
  - sonots@gmail.com
@@ -45,12 +45,18 @@ 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
53
53
  - build.gradle
54
+ - classpath/JsonPathCompiler-0.1.1.jar
55
+ - classpath/accessors-smart-1.1.jar
56
+ - classpath/asm-5.0.3.jar
57
+ - classpath/embulk-filter-typecast-0.2.2.jar
58
+ - classpath/json-smart-2.2.1.jar
59
+ - classpath/slf4j-api-1.7.21.jar
54
60
  - config/checkstyle/checkstyle.xml
55
61
  - example/empty.yml
56
62
  - example/example.csv
@@ -86,12 +92,6 @@ files:
86
92
  - src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java
87
93
  - src/test/java/org/embulk/filter/typecast/cast/TestStringCast.java
88
94
  - src/test/java/org/embulk/filter/typecast/cast/TestTimestampCast.java
89
- - classpath/accessors-smart-1.1.jar
90
- - classpath/asm-5.0.3.jar
91
- - classpath/embulk-filter-typecast-0.2.1.jar
92
- - classpath/json-smart-2.2.1.jar
93
- - classpath/JsonPathCompiler-0.1.1.jar
94
- - classpath/slf4j-api-1.7.21.jar
95
95
  homepage: https://github.com/sonots/embulk-filter-typecast
96
96
  licenses:
97
97
  - MIT
@@ -102,17 +102,17 @@ require_paths:
102
102
  - lib
103
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - '>='
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.1.9
115
+ rubygems_version: 2.6.8
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: A filter plugin for Embulk to cast column type
@@ -1,41 +0,0 @@
1
- in:
2
- type: file
3
- path_prefix: example/example.csv
4
- parser:
5
- type: csv
6
- charset: UTF-8
7
- newline: CRLF
8
- null_string: ''
9
- skip_header_lines: 1
10
- comment_line_marker: '#'
11
- columns:
12
- - {name: timestamp, type: string}
13
- - {name: "null", type: string}
14
- - {name: long, type: string}
15
- - {name: string, type: string}
16
- - {name: double, type: string}
17
- - {name: json1, type: string}
18
- - {name: json2, type: string}
19
- - {name: array_str, type: string}
20
- - {name: array_int, type: string}
21
- - {name: ignore, type: string}
22
- - {name: boolean, type: string}
23
- filters:
24
- - type: typecast
25
- columns:
26
- - {name: timestamp, type: timestamp, format: "%Y-%m-%d %H:%M:%S.%N", timezone: "+09:00"}
27
- - {name: "null", type: long}
28
- - {name: long, type: long}
29
- - {name: string, type: string}
30
- - {name: double, type: double}
31
- - {name: json1, type: json}
32
- - {name: json2, type: json}
33
- - {name: array_str, type: json}
34
- - {name: array_int, type: json}
35
- - {name: boolean, type: boolean}
36
- - {name: "$.json1.string", type: long}
37
- - {name: "$.json2.long", type: long}
38
- - {name: "$.array_str[0]", type: long}
39
- - {name: "$.array_int[*]", type: long}
40
- out:
41
- type: "null"