embulk-filter-row 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +79 -0
- data/build.gradle +73 -0
- data/classpath/embulk-filter-row-0.1.0.jar +0 -0
- data/example.yml +37 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/gradlew +164 -0
- data/gradlew.bat +90 -0
- data/lib/embulk/filter/row.rb +3 -0
- data/src/main/java/org/embulk/filter/RowFilterPlugin.java +231 -0
- data/src/main/java/org/embulk/filter/row/BooleanCondition.java +43 -0
- data/src/main/java/org/embulk/filter/row/Condition.java +5 -0
- data/src/main/java/org/embulk/filter/row/ConditionConfig.java +32 -0
- data/src/main/java/org/embulk/filter/row/ConditionFactory.java +164 -0
- data/src/main/java/org/embulk/filter/row/DoubleCondition.java +63 -0
- data/src/main/java/org/embulk/filter/row/LongCondition.java +63 -0
- data/src/main/java/org/embulk/filter/row/StringCondition.java +58 -0
- data/src/main/java/org/embulk/filter/row/TimestampCondition.java +64 -0
- data/src/test/java/org/embulk/filter/TestRowFilterPlugin.java +5 -0
- data/src/test/java/org/embulk/filter/row/TestBooleanCondition.java +64 -0
- data/src/test/java/org/embulk/filter/row/TestConditionFactory.java +250 -0
- data/src/test/java/org/embulk/filter/row/TestDoubleCondition.java +81 -0
- data/src/test/java/org/embulk/filter/row/TestLongCondition.java +81 -0
- data/src/test/java/org/embulk/filter/row/TestStringCondition.java +73 -0
- data/src/test/java/org/embulk/filter/row/TestTimestampCondition.java +83 -0
- metadata +100 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
package org.embulk.filter.row;
|
2
|
+
|
3
|
+
import org.embulk.filter.row.TimestampCondition;
|
4
|
+
import org.junit.Test;
|
5
|
+
import static org.junit.Assert.*;
|
6
|
+
|
7
|
+
import org.embulk.spi.time.Timestamp;
|
8
|
+
|
9
|
+
public class TestTimestampCondition
|
10
|
+
{
|
11
|
+
@Test
|
12
|
+
public void testIsNull() {
|
13
|
+
TimestampCondition condition = new TimestampCondition("IS NULL", null, false);
|
14
|
+
assertTrue(condition.compare(null));
|
15
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
|
16
|
+
}
|
17
|
+
|
18
|
+
@Test
|
19
|
+
public void testIsNotNull() {
|
20
|
+
TimestampCondition condition = new TimestampCondition("IS NOT NULL", null, false);
|
21
|
+
assertFalse(condition.compare(null));
|
22
|
+
assertTrue(condition.compare(Timestamp.ofEpochSecond(10)));
|
23
|
+
}
|
24
|
+
|
25
|
+
@Test
|
26
|
+
public void testEquals() {
|
27
|
+
TimestampCondition condition = new TimestampCondition("==", Timestamp.ofEpochSecond(10), false);
|
28
|
+
assertFalse(condition.compare(null));
|
29
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(10)));
|
30
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
|
31
|
+
|
32
|
+
// Prohibited by Factory
|
33
|
+
// TimestampCondition condition = new TimestampCondition("==", null, false);
|
34
|
+
}
|
35
|
+
|
36
|
+
@Test
|
37
|
+
public void testNotEquals() {
|
38
|
+
TimestampCondition condition = new TimestampCondition("!=", Timestamp.ofEpochSecond(10), false);
|
39
|
+
assertTrue( condition.compare(null));
|
40
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
|
41
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
|
42
|
+
}
|
43
|
+
|
44
|
+
@Test
|
45
|
+
public void testGreaterThan() {
|
46
|
+
TimestampCondition condition = new TimestampCondition(">", Timestamp.ofEpochSecond(10), false);
|
47
|
+
assertFalse(condition.compare(null));
|
48
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
|
49
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
|
50
|
+
}
|
51
|
+
|
52
|
+
@Test
|
53
|
+
public void testGreaterEqual() {
|
54
|
+
TimestampCondition condition = new TimestampCondition(">=", Timestamp.ofEpochSecond(11), false);
|
55
|
+
assertFalse(condition.compare(null));
|
56
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
|
57
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
|
58
|
+
}
|
59
|
+
|
60
|
+
@Test
|
61
|
+
public void testLessThan() {
|
62
|
+
TimestampCondition condition = new TimestampCondition("<", Timestamp.ofEpochSecond(11), false);
|
63
|
+
assertFalse(condition.compare(null));
|
64
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
|
65
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(10)));
|
66
|
+
}
|
67
|
+
|
68
|
+
@Test
|
69
|
+
public void testLessEqual() {
|
70
|
+
TimestampCondition condition = new TimestampCondition("<=", Timestamp.ofEpochSecond(11), false);
|
71
|
+
assertFalse(condition.compare(null));
|
72
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(12)));
|
73
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
|
74
|
+
}
|
75
|
+
|
76
|
+
@Test
|
77
|
+
public void testNot() {
|
78
|
+
TimestampCondition condition = new TimestampCondition("<=", Timestamp.ofEpochSecond(11), true);
|
79
|
+
assertTrue( condition.compare(null));
|
80
|
+
assertTrue( condition.compare(Timestamp.ofEpochSecond(12)));
|
81
|
+
assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
|
82
|
+
}
|
83
|
+
}
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: embulk-filter-row
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Naotoshi Seo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.0'
|
19
|
+
name: bundler
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '10.0'
|
33
|
+
name: rake
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: A filter plugin for Embulk to filter out rows.
|
42
|
+
email:
|
43
|
+
- sonots@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- CHANGELOG.md
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- build.gradle
|
53
|
+
- example.yml
|
54
|
+
- gradle/wrapper/gradle-wrapper.jar
|
55
|
+
- gradle/wrapper/gradle-wrapper.properties
|
56
|
+
- gradlew
|
57
|
+
- gradlew.bat
|
58
|
+
- lib/embulk/filter/row.rb
|
59
|
+
- src/main/java/org/embulk/filter/RowFilterPlugin.java
|
60
|
+
- src/main/java/org/embulk/filter/row/BooleanCondition.java
|
61
|
+
- src/main/java/org/embulk/filter/row/Condition.java
|
62
|
+
- src/main/java/org/embulk/filter/row/ConditionConfig.java
|
63
|
+
- src/main/java/org/embulk/filter/row/ConditionFactory.java
|
64
|
+
- src/main/java/org/embulk/filter/row/DoubleCondition.java
|
65
|
+
- src/main/java/org/embulk/filter/row/LongCondition.java
|
66
|
+
- src/main/java/org/embulk/filter/row/StringCondition.java
|
67
|
+
- src/main/java/org/embulk/filter/row/TimestampCondition.java
|
68
|
+
- src/test/java/org/embulk/filter/TestRowFilterPlugin.java
|
69
|
+
- src/test/java/org/embulk/filter/row/TestBooleanCondition.java
|
70
|
+
- src/test/java/org/embulk/filter/row/TestConditionFactory.java
|
71
|
+
- src/test/java/org/embulk/filter/row/TestDoubleCondition.java
|
72
|
+
- src/test/java/org/embulk/filter/row/TestLongCondition.java
|
73
|
+
- src/test/java/org/embulk/filter/row/TestStringCondition.java
|
74
|
+
- src/test/java/org/embulk/filter/row/TestTimestampCondition.java
|
75
|
+
- classpath/embulk-filter-row-0.1.0.jar
|
76
|
+
homepage: https://github.com/sonots/embulk-filter-row
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.1.9
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: A filter plugin for Embulk to filter out rows
|
100
|
+
test_files: []
|