embulk-filter-row 0.5.0 → 0.5.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: 7c0430c1f25c684a07ddcb0112ec276efebafc20
|
4
|
+
data.tar.gz: 5fe2f45f5adc211e6a77f829782dd348e9182f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99c28c3e038b21bd345da0bd20c43d61b311d884fe7d87f17d1f353f942879200a48d0a6c46e087ef274536202474929af13c3f5aa3047a7c90fb85644af428c
|
7
|
+
data.tar.gz: f50ab553637be0af685a8883edc49468e11388c7b30d22ffa86db33a5d1f859b1a058ee3881e1f5e2b26c239495c4e80de375d7ec99e30667143a35188af9f31
|
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
@@ -15,13 +15,13 @@ configurations {
|
|
15
15
|
provided
|
16
16
|
}
|
17
17
|
|
18
|
-
version = "0.5.
|
18
|
+
version = "0.5.1"
|
19
19
|
sourceCompatibility = 1.7
|
20
20
|
targetCompatibility = 1.7
|
21
21
|
|
22
22
|
dependencies {
|
23
|
-
compile "org.embulk:embulk-core:0.8
|
24
|
-
provided "org.embulk:embulk-core:0.8
|
23
|
+
compile "org.embulk:embulk-core:0.8.+"
|
24
|
+
provided "org.embulk:embulk-core:0.8.+"
|
25
25
|
|
26
26
|
compile "org.jruby.joni:joni:2.1.11"
|
27
27
|
compile "org.jruby.jcodings:jcodings:1.0.18"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
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
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package org.embulk.filter.row.condition;
|
2
2
|
|
3
|
+
import com.google.common.base.Optional;
|
3
4
|
import com.google.common.base.Throwables;
|
4
5
|
|
5
6
|
import org.apache.commons.lang3.math.NumberUtils;
|
@@ -15,6 +16,7 @@ import org.embulk.spi.type.StringType;
|
|
15
16
|
import org.embulk.spi.type.TimestampType;
|
16
17
|
import org.embulk.spi.type.Type;
|
17
18
|
import org.joda.time.DateTimeZone;
|
19
|
+
import org.jruby.embed.ScriptingContainer;
|
18
20
|
|
19
21
|
public class ConditionFactory
|
20
22
|
{
|
@@ -137,7 +139,7 @@ public class ConditionFactory
|
|
137
139
|
String format = (String) conditionConfig.getFormat().get();
|
138
140
|
DateTimeZone timezone = DateTimeZone.forID((String) conditionConfig.getTimezone().get());
|
139
141
|
|
140
|
-
TimestampParser parser =
|
142
|
+
TimestampParser parser = getTimestampParser(format, timezone);
|
141
143
|
try {
|
142
144
|
Timestamp timestamp = parser.parse(argument);
|
143
145
|
return new TimestampCondition(operator, timestamp, not);
|
@@ -150,4 +152,83 @@ public class ConditionFactory
|
|
150
152
|
throw new ConfigException(String.format("RowFilterPlugin: Type mismatch on column: %s", columnName));
|
151
153
|
}
|
152
154
|
}
|
155
|
+
|
156
|
+
private class TimestampParserTaskImpl implements TimestampParser.Task
|
157
|
+
{
|
158
|
+
private final DateTimeZone defaultTimeZone;
|
159
|
+
private final String defaultTimestampFormat;
|
160
|
+
private final String defaultDate;
|
161
|
+
public TimestampParserTaskImpl(
|
162
|
+
DateTimeZone defaultTimeZone,
|
163
|
+
String defaultTimestampFormat,
|
164
|
+
String defaultDate)
|
165
|
+
{
|
166
|
+
this.defaultTimeZone = defaultTimeZone;
|
167
|
+
this.defaultTimestampFormat = defaultTimestampFormat;
|
168
|
+
this.defaultDate = defaultDate;
|
169
|
+
}
|
170
|
+
@Override
|
171
|
+
public DateTimeZone getDefaultTimeZone()
|
172
|
+
{
|
173
|
+
return this.defaultTimeZone;
|
174
|
+
}
|
175
|
+
@Override
|
176
|
+
public String getDefaultTimestampFormat()
|
177
|
+
{
|
178
|
+
return this.defaultTimestampFormat;
|
179
|
+
}
|
180
|
+
@Override
|
181
|
+
public String getDefaultDate()
|
182
|
+
{
|
183
|
+
return this.defaultDate;
|
184
|
+
}
|
185
|
+
@Override
|
186
|
+
public ScriptingContainer getJRuby()
|
187
|
+
{
|
188
|
+
return null;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
private class TimestampParserColumnOptionImpl implements TimestampParser.TimestampColumnOption
|
193
|
+
{
|
194
|
+
private final Optional<DateTimeZone> timeZone;
|
195
|
+
private final Optional<String> format;
|
196
|
+
private final Optional<String> date;
|
197
|
+
public TimestampParserColumnOptionImpl(
|
198
|
+
Optional<DateTimeZone> timeZone,
|
199
|
+
Optional<String> format,
|
200
|
+
Optional<String> date)
|
201
|
+
{
|
202
|
+
this.timeZone = timeZone;
|
203
|
+
this.format = format;
|
204
|
+
this.date = date;
|
205
|
+
}
|
206
|
+
@Override
|
207
|
+
public Optional<DateTimeZone> getTimeZone()
|
208
|
+
{
|
209
|
+
return this.timeZone;
|
210
|
+
}
|
211
|
+
@Override
|
212
|
+
public Optional<String> getFormat()
|
213
|
+
{
|
214
|
+
return this.format;
|
215
|
+
}
|
216
|
+
@Override
|
217
|
+
public Optional<String> getDate()
|
218
|
+
{
|
219
|
+
return this.date;
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
private TimestampParser getTimestampParser(String format, DateTimeZone timezone)
|
224
|
+
{
|
225
|
+
// ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
|
226
|
+
//
|
227
|
+
// return new TimestampParser(format, timezone);
|
228
|
+
String date = "1970-01-01";
|
229
|
+
TimestampParserTaskImpl task = new TimestampParserTaskImpl(timezone, format, date);
|
230
|
+
TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
|
231
|
+
Optional.of(timezone), Optional.of(format), Optional.of(date));
|
232
|
+
return new TimestampParser(task, columnOption);
|
233
|
+
}
|
153
234
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package org.embulk.filter.row.where;
|
2
2
|
|
3
|
+
import com.google.common.base.Optional;
|
3
4
|
import com.google.common.base.Throwables;
|
4
5
|
import org.embulk.config.ConfigException;
|
5
6
|
import org.embulk.spi.Column;
|
@@ -16,6 +17,7 @@ import org.embulk.spi.type.StringType;
|
|
16
17
|
import org.embulk.spi.type.TimestampType;
|
17
18
|
import org.embulk.spi.type.Type;
|
18
19
|
import org.joda.time.DateTimeZone;
|
20
|
+
import org.jruby.embed.ScriptingContainer;
|
19
21
|
import org.msgpack.value.Value;
|
20
22
|
|
21
23
|
// Literal Node of AST (Abstract Syntax Tree)
|
@@ -140,7 +142,7 @@ class StringLiteral extends ParserLiteral
|
|
140
142
|
class TimestampLiteral extends ParserLiteral
|
141
143
|
{
|
142
144
|
protected Timestamp val;
|
143
|
-
private static final DateTimeZone
|
145
|
+
private static final DateTimeZone defaultTimeZone = DateTimeZone.forID("UTC");
|
144
146
|
|
145
147
|
public TimestampLiteral(ParserLiteral literal)
|
146
148
|
{
|
@@ -178,7 +180,7 @@ class TimestampLiteral extends ParserLiteral
|
|
178
180
|
TimestampParseException ex = null;
|
179
181
|
for (String format : formats) {
|
180
182
|
try {
|
181
|
-
TimestampParser timestampParser =
|
183
|
+
TimestampParser timestampParser = getTimestampParser(format, defaultTimeZone);
|
182
184
|
this.val = timestampParser.parse(literal.val);
|
183
185
|
break;
|
184
186
|
}
|
@@ -215,6 +217,86 @@ class TimestampLiteral extends ParserLiteral
|
|
215
217
|
{
|
216
218
|
return val;
|
217
219
|
}
|
220
|
+
|
221
|
+
private class TimestampParserTaskImpl implements TimestampParser.Task
|
222
|
+
{
|
223
|
+
private final DateTimeZone defaultTimeZone;
|
224
|
+
private final String defaultTimestampFormat;
|
225
|
+
private final String defaultDate;
|
226
|
+
public TimestampParserTaskImpl(
|
227
|
+
DateTimeZone defaultTimeZone,
|
228
|
+
String defaultTimestampFormat,
|
229
|
+
String defaultDate)
|
230
|
+
{
|
231
|
+
this.defaultTimeZone = defaultTimeZone;
|
232
|
+
this.defaultTimestampFormat = defaultTimestampFormat;
|
233
|
+
this.defaultDate = defaultDate;
|
234
|
+
}
|
235
|
+
@Override
|
236
|
+
public DateTimeZone getDefaultTimeZone()
|
237
|
+
{
|
238
|
+
return this.defaultTimeZone;
|
239
|
+
}
|
240
|
+
@Override
|
241
|
+
public String getDefaultTimestampFormat()
|
242
|
+
{
|
243
|
+
return this.defaultTimestampFormat;
|
244
|
+
}
|
245
|
+
@Override
|
246
|
+
public String getDefaultDate()
|
247
|
+
{
|
248
|
+
return this.defaultDate;
|
249
|
+
}
|
250
|
+
@Override
|
251
|
+
public ScriptingContainer getJRuby()
|
252
|
+
{
|
253
|
+
return null;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
private class TimestampParserColumnOptionImpl implements TimestampParser.TimestampColumnOption
|
258
|
+
{
|
259
|
+
private final Optional<DateTimeZone> timeZone;
|
260
|
+
private final Optional<String> format;
|
261
|
+
private final Optional<String> date;
|
262
|
+
public TimestampParserColumnOptionImpl(
|
263
|
+
Optional<DateTimeZone> timeZone,
|
264
|
+
Optional<String> format,
|
265
|
+
Optional<String> date)
|
266
|
+
{
|
267
|
+
this.timeZone = timeZone;
|
268
|
+
this.format = format;
|
269
|
+
this.date = date;
|
270
|
+
}
|
271
|
+
@Override
|
272
|
+
public Optional<DateTimeZone> getTimeZone()
|
273
|
+
{
|
274
|
+
return this.timeZone;
|
275
|
+
}
|
276
|
+
@Override
|
277
|
+
public Optional<String> getFormat()
|
278
|
+
{
|
279
|
+
return this.format;
|
280
|
+
}
|
281
|
+
@Override
|
282
|
+
public Optional<String> getDate()
|
283
|
+
{
|
284
|
+
return this.date;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
private TimestampParser getTimestampParser(String format, DateTimeZone timezone)
|
289
|
+
{
|
290
|
+
// ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
|
291
|
+
//
|
292
|
+
// return new TimestampParser(format, timezone);
|
293
|
+
String date = "1970-01-01";
|
294
|
+
TimestampParserTaskImpl task = new TimestampParserTaskImpl(timezone, format, date);
|
295
|
+
TimestampParserColumnOptionImpl columnOption = new TimestampParserColumnOptionImpl(
|
296
|
+
Optional.of(timezone), Optional.of(format), Optional.of(date));
|
297
|
+
return new TimestampParser(task, columnOption);
|
298
|
+
}
|
299
|
+
|
218
300
|
}
|
219
301
|
|
220
302
|
class IdentifierLiteral extends ParserLiteral
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-row
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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
|
@@ -96,7 +96,7 @@ files:
|
|
96
96
|
- src/test/java/org/embulk/filter/row/condition/TestTimestampCondition.java
|
97
97
|
- src/test/java/org/embulk/filter/row/where/TestParser.java
|
98
98
|
- src/test/java/org/embulk/filter/row/where/TestYylex.java
|
99
|
-
- classpath/embulk-filter-row-0.5.
|
99
|
+
- classpath/embulk-filter-row-0.5.1.jar
|
100
100
|
- classpath/jcodings-1.0.18.jar
|
101
101
|
- classpath/joni-2.1.11.jar
|
102
102
|
homepage: https://github.com/sonots/embulk-filter-row
|