embulk-filter-row 0.2.0 → 0.2.1
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/CHANGELOG.md +6 -0
- data/README.md +7 -1
- data/build.gradle +6 -1
- data/classpath/embulk-filter-row-0.2.1.jar +0 -0
- data/config/checkstyle/checkstyle.xml +127 -0
- data/example/example.csv +100 -0
- data/settings.gradle +1 -0
- data/src/main/java/org/embulk/filter/RowFilterPlugin.java +226 -115
- data/src/main/java/org/embulk/filter/row/BooleanCondition.java +16 -8
- data/src/main/java/org/embulk/filter/row/ConditionConfig.java +1 -1
- data/src/main/java/org/embulk/filter/row/ConditionFactory.java +20 -28
- data/src/main/java/org/embulk/filter/row/DoubleCondition.java +24 -12
- data/src/main/java/org/embulk/filter/row/LongCondition.java +31 -18
- data/src/main/java/org/embulk/filter/row/StringCondition.java +22 -11
- data/src/main/java/org/embulk/filter/row/TimestampCondition.java +24 -12
- data/src/test/java/org/embulk/filter/row/TestBooleanCondition.java +13 -7
- data/src/test/java/org/embulk/filter/row/TestConditionFactory.java +232 -95
- data/src/test/java/org/embulk/filter/row/TestDoubleCondition.java +44 -20
- data/src/test/java/org/embulk/filter/row/TestLongCondition.java +100 -27
- data/src/test/java/org/embulk/filter/row/TestStringCondition.java +36 -24
- data/src/test/java/org/embulk/filter/row/TestTimestampCondition.java +31 -21
- metadata +6 -3
- data/classpath/embulk-filter-row-0.2.0.jar +0 -0
@@ -2,45 +2,37 @@ package org.embulk.filter;
|
|
2
2
|
|
3
3
|
import org.embulk.config.Config;
|
4
4
|
import org.embulk.config.ConfigDefault;
|
5
|
-
import org.embulk.config.ConfigDiff;
|
6
|
-
import org.embulk.config.ConfigSource;
|
7
5
|
import org.embulk.config.ConfigException;
|
6
|
+
import org.embulk.config.ConfigSource;
|
8
7
|
import org.embulk.config.Task;
|
9
8
|
import org.embulk.config.TaskSource;
|
10
9
|
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import org.
|
16
|
-
|
17
|
-
import org.embulk.
|
18
|
-
import org.embulk.
|
19
|
-
import org.embulk.spi.type.LongType;
|
20
|
-
import org.embulk.spi.type.DoubleType;
|
21
|
-
import org.embulk.spi.type.StringType;
|
22
|
-
import org.embulk.spi.type.TimestampType;
|
23
|
-
import org.embulk.spi.time.Timestamp;
|
10
|
+
import org.embulk.filter.row.BooleanCondition;
|
11
|
+
import org.embulk.filter.row.Condition;
|
12
|
+
import org.embulk.filter.row.ConditionConfig;
|
13
|
+
import org.embulk.filter.row.ConditionFactory;
|
14
|
+
import org.embulk.filter.row.DoubleCondition;
|
15
|
+
import org.embulk.filter.row.LongCondition;
|
16
|
+
import org.embulk.filter.row.StringCondition;
|
17
|
+
import org.embulk.filter.row.TimestampCondition;
|
24
18
|
|
25
|
-
import org.embulk.spi.
|
19
|
+
import org.embulk.spi.Column;
|
20
|
+
import org.embulk.spi.ColumnVisitor;
|
26
21
|
import org.embulk.spi.Exec;
|
22
|
+
import org.embulk.spi.FilterPlugin;
|
27
23
|
import org.embulk.spi.Page;
|
28
24
|
import org.embulk.spi.PageBuilder;
|
29
25
|
import org.embulk.spi.PageOutput;
|
30
26
|
import org.embulk.spi.PageReader;
|
31
27
|
import org.embulk.spi.Schema;
|
32
|
-
import org.embulk.spi.
|
33
|
-
import org.embulk.spi.Column;
|
34
|
-
import org.embulk.spi.ColumnVisitor;
|
28
|
+
import org.embulk.spi.time.Timestamp;
|
35
29
|
import org.embulk.spi.time.TimestampParser;
|
36
|
-
|
37
|
-
import org.
|
38
|
-
|
39
|
-
import
|
40
|
-
import
|
41
|
-
import
|
42
|
-
import org.embulk.filter.row.TimestampCondition;
|
43
|
-
import org.embulk.filter.row.ConditionFactory;
|
30
|
+
|
31
|
+
import org.slf4j.Logger;
|
32
|
+
|
33
|
+
import java.util.ArrayList;
|
34
|
+
import java.util.HashMap;
|
35
|
+
import java.util.List;
|
44
36
|
|
45
37
|
public class RowFilterPlugin implements FilterPlugin
|
46
38
|
{
|
@@ -113,237 +105,356 @@ public class RowFilterPlugin implements FilterPlugin
|
|
113
105
|
private ColumnVisitor visitor = orCondition ? new ColumnVisitorOrImpl(pageBuilder) : new ColumnVisitorAndImpl(pageBuilder);
|
114
106
|
|
115
107
|
@Override
|
116
|
-
public void finish()
|
108
|
+
public void finish()
|
109
|
+
{
|
117
110
|
pageBuilder.finish();
|
118
111
|
}
|
119
112
|
|
120
113
|
@Override
|
121
|
-
public void close()
|
114
|
+
public void close()
|
115
|
+
{
|
122
116
|
pageBuilder.close();
|
123
117
|
}
|
124
118
|
|
125
119
|
@Override
|
126
|
-
public void add(Page page)
|
120
|
+
public void add(Page page)
|
121
|
+
{
|
127
122
|
pageReader.setPage(page);
|
128
123
|
|
129
124
|
while (pageReader.nextRecord()) {
|
130
125
|
shouldAddRecord = orCondition ? false : true;
|
131
126
|
inputSchema.visitColumns(visitor);
|
132
|
-
if (shouldAddRecord)
|
127
|
+
if (shouldAddRecord) {
|
128
|
+
pageBuilder.addRecord();
|
129
|
+
}
|
133
130
|
}
|
134
131
|
}
|
135
132
|
|
136
|
-
class ColumnVisitorOrImpl implements ColumnVisitor
|
133
|
+
class ColumnVisitorOrImpl implements ColumnVisitor
|
134
|
+
{
|
137
135
|
private final PageBuilder pageBuilder;
|
138
136
|
|
139
|
-
ColumnVisitorOrImpl(PageBuilder pageBuilder)
|
137
|
+
ColumnVisitorOrImpl(PageBuilder pageBuilder)
|
138
|
+
{
|
140
139
|
this.pageBuilder = pageBuilder;
|
141
140
|
}
|
142
141
|
|
143
142
|
@Override
|
144
|
-
public void booleanColumn(Column column)
|
143
|
+
public void booleanColumn(Column column)
|
144
|
+
{
|
145
145
|
if (pageReader.isNull(column)) {
|
146
146
|
pageBuilder.setNull(column);
|
147
|
-
}
|
147
|
+
}
|
148
|
+
else {
|
148
149
|
pageBuilder.setBoolean(column, pageReader.getBoolean(column));
|
149
150
|
}
|
150
|
-
if (shouldAddRecord)
|
151
|
+
if (shouldAddRecord) {
|
152
|
+
return;
|
153
|
+
}
|
151
154
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
152
|
-
for (Condition
|
153
|
-
BooleanCondition condition = (BooleanCondition)
|
155
|
+
for (Condition tempCondition : conditionList) {
|
156
|
+
BooleanCondition condition = (BooleanCondition) tempCondition;
|
154
157
|
if (pageReader.isNull(column)) {
|
155
|
-
if (condition.compare(null)) {
|
156
|
-
|
158
|
+
if (condition.compare(null)) {
|
159
|
+
shouldAddRecord = true;
|
160
|
+
break;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
else {
|
157
164
|
boolean subject = pageReader.getBoolean(column);
|
158
|
-
if (condition.compare(subject)) {
|
165
|
+
if (condition.compare(subject)) {
|
166
|
+
shouldAddRecord = true;
|
167
|
+
break;
|
168
|
+
}
|
159
169
|
}
|
160
170
|
}
|
161
171
|
}
|
162
172
|
|
163
173
|
@Override
|
164
|
-
public void longColumn(Column column)
|
174
|
+
public void longColumn(Column column)
|
175
|
+
{
|
165
176
|
if (pageReader.isNull(column)) {
|
166
177
|
pageBuilder.setNull(column);
|
167
|
-
}
|
178
|
+
}
|
179
|
+
else {
|
168
180
|
pageBuilder.setLong(column, pageReader.getLong(column));
|
169
181
|
}
|
170
|
-
if (shouldAddRecord)
|
182
|
+
if (shouldAddRecord) {
|
183
|
+
return;
|
184
|
+
}
|
171
185
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
172
|
-
for (Condition
|
173
|
-
LongCondition condition = (LongCondition)
|
186
|
+
for (Condition tempCondition : conditionList) {
|
187
|
+
LongCondition condition = (LongCondition) tempCondition;
|
174
188
|
if (pageReader.isNull(column)) {
|
175
|
-
if (condition.compare(null)) {
|
176
|
-
|
189
|
+
if (condition.compare(null)) {
|
190
|
+
shouldAddRecord = true;
|
191
|
+
break;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
else {
|
177
195
|
long subject = pageReader.getLong(column);
|
178
|
-
if (condition.compare(subject)) {
|
196
|
+
if (condition.compare(subject)) {
|
197
|
+
shouldAddRecord = true;
|
198
|
+
break;
|
199
|
+
}
|
179
200
|
}
|
180
201
|
}
|
181
202
|
}
|
182
203
|
|
183
204
|
@Override
|
184
|
-
public void doubleColumn(Column column)
|
205
|
+
public void doubleColumn(Column column)
|
206
|
+
{
|
185
207
|
if (pageReader.isNull(column)) {
|
186
208
|
pageBuilder.setNull(column);
|
187
|
-
}
|
209
|
+
}
|
210
|
+
else {
|
188
211
|
pageBuilder.setDouble(column, pageReader.getDouble(column));
|
189
212
|
}
|
190
|
-
if (shouldAddRecord)
|
213
|
+
if (shouldAddRecord) {
|
214
|
+
return;
|
215
|
+
}
|
191
216
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
192
|
-
for (Condition
|
193
|
-
DoubleCondition condition = (DoubleCondition)
|
217
|
+
for (Condition tempCondition : conditionList) {
|
218
|
+
DoubleCondition condition = (DoubleCondition) tempCondition;
|
194
219
|
if (pageReader.isNull(column)) {
|
195
|
-
if (condition.compare(null)) {
|
196
|
-
|
220
|
+
if (condition.compare(null)) {
|
221
|
+
shouldAddRecord = true;
|
222
|
+
break;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
else {
|
197
226
|
double subject = pageReader.getDouble(column);
|
198
|
-
if (condition.compare(subject)) {
|
227
|
+
if (condition.compare(subject)) {
|
228
|
+
shouldAddRecord = true;
|
229
|
+
break;
|
230
|
+
}
|
199
231
|
}
|
200
232
|
}
|
201
233
|
}
|
202
234
|
|
203
235
|
@Override
|
204
|
-
public void stringColumn(Column column)
|
236
|
+
public void stringColumn(Column column)
|
237
|
+
{
|
205
238
|
if (pageReader.isNull(column)) {
|
206
239
|
pageBuilder.setNull(column);
|
207
|
-
}
|
240
|
+
}
|
241
|
+
else {
|
208
242
|
pageBuilder.setString(column, pageReader.getString(column));
|
209
243
|
}
|
210
|
-
if (shouldAddRecord)
|
244
|
+
if (shouldAddRecord) {
|
245
|
+
return;
|
246
|
+
}
|
211
247
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
212
|
-
for (Condition
|
213
|
-
StringCondition condition = (StringCondition)
|
248
|
+
for (Condition tempCondition : conditionList) {
|
249
|
+
StringCondition condition = (StringCondition) tempCondition;
|
214
250
|
if (pageReader.isNull(column)) {
|
215
|
-
if (condition.compare(null)) {
|
216
|
-
|
251
|
+
if (condition.compare(null)) {
|
252
|
+
shouldAddRecord = true;
|
253
|
+
break;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
else {
|
217
257
|
String subject = pageReader.getString(column);
|
218
|
-
if (condition.compare(subject)) {
|
258
|
+
if (condition.compare(subject)) {
|
259
|
+
shouldAddRecord = true;
|
260
|
+
break;
|
261
|
+
}
|
219
262
|
}
|
220
263
|
}
|
221
264
|
}
|
222
265
|
|
223
266
|
@Override
|
224
|
-
public void timestampColumn(Column column)
|
267
|
+
public void timestampColumn(Column column)
|
268
|
+
{
|
225
269
|
if (pageReader.isNull(column)) {
|
226
270
|
pageBuilder.setNull(column);
|
227
|
-
}
|
271
|
+
}
|
272
|
+
else {
|
228
273
|
pageBuilder.setTimestamp(column, pageReader.getTimestamp(column));
|
229
274
|
}
|
230
|
-
if (shouldAddRecord)
|
275
|
+
if (shouldAddRecord) {
|
276
|
+
return;
|
277
|
+
}
|
231
278
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
232
|
-
for (Condition
|
233
|
-
TimestampCondition condition = (TimestampCondition)
|
279
|
+
for (Condition tempCondition : conditionList) {
|
280
|
+
TimestampCondition condition = (TimestampCondition) tempCondition;
|
234
281
|
if (pageReader.isNull(column)) {
|
235
|
-
if (condition.compare(null)) {
|
236
|
-
|
282
|
+
if (condition.compare(null)) {
|
283
|
+
shouldAddRecord = true;
|
284
|
+
break;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
else {
|
237
288
|
Timestamp subject = pageReader.getTimestamp(column);
|
238
|
-
if (condition.compare(subject)) {
|
289
|
+
if (condition.compare(subject)) {
|
290
|
+
shouldAddRecord = true;
|
291
|
+
break;
|
292
|
+
}
|
239
293
|
}
|
240
294
|
}
|
241
295
|
}
|
242
296
|
}
|
243
297
|
|
244
|
-
class ColumnVisitorAndImpl implements ColumnVisitor
|
298
|
+
class ColumnVisitorAndImpl implements ColumnVisitor
|
299
|
+
{
|
245
300
|
private final PageBuilder pageBuilder;
|
246
301
|
|
247
|
-
ColumnVisitorAndImpl(PageBuilder pageBuilder)
|
302
|
+
ColumnVisitorAndImpl(PageBuilder pageBuilder)
|
303
|
+
{
|
248
304
|
this.pageBuilder = pageBuilder;
|
249
305
|
}
|
250
306
|
|
251
307
|
@Override
|
252
|
-
public void booleanColumn(Column column)
|
253
|
-
|
308
|
+
public void booleanColumn(Column column)
|
309
|
+
{
|
310
|
+
if (!shouldAddRecord) {
|
311
|
+
return;
|
312
|
+
}
|
254
313
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
255
|
-
for (Condition
|
256
|
-
BooleanCondition condition = (BooleanCondition)
|
314
|
+
for (Condition tempCondition : conditionList) {
|
315
|
+
BooleanCondition condition = (BooleanCondition) tempCondition;
|
257
316
|
if (pageReader.isNull(column)) {
|
258
|
-
if (!condition.compare(null)) {
|
259
|
-
|
317
|
+
if (!condition.compare(null)) {
|
318
|
+
shouldAddRecord = false;
|
319
|
+
break;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
else {
|
260
323
|
boolean subject = pageReader.getBoolean(column);
|
261
|
-
if (!condition.compare(subject)) {
|
324
|
+
if (!condition.compare(subject)) {
|
325
|
+
shouldAddRecord = false;
|
326
|
+
break;
|
327
|
+
}
|
262
328
|
}
|
263
329
|
}
|
264
330
|
if (pageReader.isNull(column)) {
|
265
331
|
pageBuilder.setNull(column);
|
266
|
-
}
|
332
|
+
}
|
333
|
+
else {
|
267
334
|
pageBuilder.setBoolean(column, pageReader.getBoolean(column));
|
268
335
|
}
|
269
336
|
}
|
270
337
|
|
271
338
|
@Override
|
272
|
-
public void longColumn(Column column)
|
273
|
-
|
339
|
+
public void longColumn(Column column)
|
340
|
+
{
|
341
|
+
if (!shouldAddRecord) {
|
342
|
+
return;
|
343
|
+
}
|
274
344
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
275
|
-
for (Condition
|
276
|
-
LongCondition condition = (LongCondition)
|
345
|
+
for (Condition tempCondition : conditionList) {
|
346
|
+
LongCondition condition = (LongCondition) tempCondition;
|
277
347
|
if (pageReader.isNull(column)) {
|
278
|
-
if (!condition.compare(null)) {
|
279
|
-
|
348
|
+
if (!condition.compare(null)) {
|
349
|
+
shouldAddRecord = false;
|
350
|
+
break;
|
351
|
+
}
|
352
|
+
}
|
353
|
+
else {
|
280
354
|
long subject = pageReader.getLong(column);
|
281
|
-
if (!condition.compare(subject)) {
|
355
|
+
if (!condition.compare(subject)) {
|
356
|
+
shouldAddRecord = false;
|
357
|
+
break;
|
358
|
+
}
|
282
359
|
}
|
283
360
|
}
|
284
361
|
if (pageReader.isNull(column)) {
|
285
362
|
pageBuilder.setNull(column);
|
286
|
-
}
|
363
|
+
}
|
364
|
+
else {
|
287
365
|
pageBuilder.setLong(column, pageReader.getLong(column));
|
288
366
|
}
|
289
367
|
}
|
290
368
|
|
291
369
|
@Override
|
292
|
-
public void doubleColumn(Column column)
|
293
|
-
|
370
|
+
public void doubleColumn(Column column)
|
371
|
+
{
|
372
|
+
if (!shouldAddRecord) {
|
373
|
+
return;
|
374
|
+
}
|
294
375
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
295
|
-
for (Condition
|
296
|
-
DoubleCondition condition = (DoubleCondition)
|
376
|
+
for (Condition tempCondition : conditionList) {
|
377
|
+
DoubleCondition condition = (DoubleCondition) tempCondition;
|
297
378
|
if (pageReader.isNull(column)) {
|
298
|
-
if (!condition.compare(null)) {
|
299
|
-
|
379
|
+
if (!condition.compare(null)) {
|
380
|
+
shouldAddRecord = false;
|
381
|
+
break;
|
382
|
+
}
|
383
|
+
}
|
384
|
+
else {
|
300
385
|
double subject = pageReader.getDouble(column);
|
301
|
-
if (!condition.compare(subject)) {
|
386
|
+
if (!condition.compare(subject)) {
|
387
|
+
shouldAddRecord = false;
|
388
|
+
break;
|
389
|
+
}
|
302
390
|
}
|
303
391
|
}
|
304
392
|
if (pageReader.isNull(column)) {
|
305
393
|
pageBuilder.setNull(column);
|
306
|
-
}
|
394
|
+
}
|
395
|
+
else {
|
307
396
|
pageBuilder.setDouble(column, pageReader.getDouble(column));
|
308
397
|
}
|
309
398
|
}
|
310
399
|
|
311
400
|
@Override
|
312
|
-
public void stringColumn(Column column)
|
313
|
-
|
401
|
+
public void stringColumn(Column column)
|
402
|
+
{
|
403
|
+
if (!shouldAddRecord) {
|
404
|
+
return;
|
405
|
+
}
|
314
406
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
315
|
-
for (Condition
|
316
|
-
StringCondition condition = (StringCondition)
|
407
|
+
for (Condition tempCondition : conditionList) {
|
408
|
+
StringCondition condition = (StringCondition) tempCondition;
|
317
409
|
if (pageReader.isNull(column)) {
|
318
|
-
if (!condition.compare(null)) {
|
319
|
-
|
410
|
+
if (!condition.compare(null)) {
|
411
|
+
shouldAddRecord = false;
|
412
|
+
break;
|
413
|
+
}
|
414
|
+
}
|
415
|
+
else {
|
320
416
|
String subject = pageReader.getString(column);
|
321
|
-
if (!condition.compare(subject)) {
|
417
|
+
if (!condition.compare(subject)) {
|
418
|
+
shouldAddRecord = false;
|
419
|
+
break;
|
420
|
+
}
|
322
421
|
}
|
323
422
|
}
|
324
423
|
if (pageReader.isNull(column)) {
|
325
424
|
pageBuilder.setNull(column);
|
326
|
-
}
|
425
|
+
}
|
426
|
+
else {
|
327
427
|
pageBuilder.setString(column, pageReader.getString(column));
|
328
428
|
}
|
329
429
|
}
|
330
430
|
|
331
431
|
@Override
|
332
|
-
public void timestampColumn(Column column)
|
333
|
-
|
432
|
+
public void timestampColumn(Column column)
|
433
|
+
{
|
434
|
+
if (!shouldAddRecord) {
|
435
|
+
return;
|
436
|
+
}
|
334
437
|
List<Condition> conditionList = conditionMap.get(column.getName());
|
335
|
-
for (Condition
|
336
|
-
TimestampCondition condition = (TimestampCondition)
|
438
|
+
for (Condition tempCondition : conditionList) {
|
439
|
+
TimestampCondition condition = (TimestampCondition) tempCondition;
|
337
440
|
if (pageReader.isNull(column)) {
|
338
|
-
if (!condition.compare(null)) {
|
339
|
-
|
441
|
+
if (!condition.compare(null)) {
|
442
|
+
shouldAddRecord = false;
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
else {
|
340
447
|
Timestamp subject = pageReader.getTimestamp(column);
|
341
|
-
if (!condition.compare(subject)) {
|
448
|
+
if (!condition.compare(subject)) {
|
449
|
+
shouldAddRecord = false;
|
450
|
+
break;
|
451
|
+
}
|
342
452
|
}
|
343
453
|
}
|
344
454
|
if (pageReader.isNull(column)) {
|
345
455
|
pageBuilder.setNull(column);
|
346
|
-
}
|
456
|
+
}
|
457
|
+
else {
|
347
458
|
pageBuilder.setTimestamp(column, pageReader.getTimestamp(column));
|
348
459
|
}
|
349
460
|
}
|
@@ -5,37 +5,43 @@ public class BooleanCondition implements Condition
|
|
5
5
|
private BooleanComparator comparator;
|
6
6
|
|
7
7
|
// @FunctionalInterface
|
8
|
-
interface BooleanComparator
|
8
|
+
interface BooleanComparator
|
9
|
+
{
|
9
10
|
boolean compare(Boolean subject);
|
10
11
|
}
|
11
12
|
|
12
|
-
public BooleanCondition(final String operator, final Boolean argument, final boolean not)
|
13
|
+
public BooleanCondition(final String operator, final Boolean argument, final boolean not)
|
14
|
+
{
|
13
15
|
final BooleanComparator comparator;
|
14
16
|
switch (operator.toUpperCase()) {
|
15
17
|
case "IS NULL":
|
16
18
|
comparator = new BooleanComparator() {
|
17
|
-
public boolean compare(Boolean subject)
|
19
|
+
public boolean compare(Boolean subject)
|
20
|
+
{
|
18
21
|
return subject == null;
|
19
22
|
}
|
20
23
|
};
|
21
24
|
break;
|
22
25
|
case "IS NOT NULL":
|
23
26
|
comparator = new BooleanComparator() {
|
24
|
-
public boolean compare(Boolean subject)
|
27
|
+
public boolean compare(Boolean subject)
|
28
|
+
{
|
25
29
|
return subject != null;
|
26
30
|
}
|
27
31
|
};
|
28
32
|
break;
|
29
33
|
case "!=":
|
30
34
|
comparator = new BooleanComparator() {
|
31
|
-
public boolean compare(Boolean subject)
|
35
|
+
public boolean compare(Boolean subject)
|
36
|
+
{
|
32
37
|
return subject == null ? true : !subject.equals(argument);
|
33
38
|
}
|
34
39
|
};
|
35
40
|
break;
|
36
41
|
default: // case "==":
|
37
42
|
comparator = new BooleanComparator() {
|
38
|
-
public boolean compare(Boolean subject)
|
43
|
+
public boolean compare(Boolean subject)
|
44
|
+
{
|
39
45
|
return subject == null ? false : subject.equals(argument);
|
40
46
|
}
|
41
47
|
};
|
@@ -44,14 +50,16 @@ public class BooleanCondition implements Condition
|
|
44
50
|
this.comparator = comparator;
|
45
51
|
if (not) {
|
46
52
|
this.comparator = new BooleanComparator() {
|
47
|
-
public boolean compare(Boolean subject)
|
53
|
+
public boolean compare(Boolean subject)
|
54
|
+
{
|
48
55
|
return !comparator.compare(subject);
|
49
56
|
}
|
50
57
|
};
|
51
58
|
}
|
52
59
|
}
|
53
60
|
|
54
|
-
public boolean compare(Boolean subject)
|
61
|
+
public boolean compare(Boolean subject)
|
62
|
+
{
|
55
63
|
return this.comparator.compare(subject);
|
56
64
|
}
|
57
65
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
package org.embulk.filter.row;
|
2
2
|
|
3
|
+
import com.google.common.base.Optional;
|
3
4
|
import org.embulk.config.Config;
|
4
5
|
import org.embulk.config.ConfigDefault;
|
5
6
|
import org.embulk.config.Task;
|
6
|
-
import com.google.common.base.Optional;
|
7
7
|
|
8
8
|
public interface ConditionConfig extends Task
|
9
9
|
{
|