embulk-filter-row 0.1.0 → 0.1.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: f66bb07654c8eddf0af81a5cb4997c5f072ee195
4
- data.tar.gz: 135e7b573d9523b9247317d93f3efe7ed80b0e5b
3
+ metadata.gz: a1c2f1a6bc6b0e1a1e98b4240c83e879291023e5
4
+ data.tar.gz: 75b58ba155f1bf25eba03b33cecff456bfe2c73e
5
5
  SHA512:
6
- metadata.gz: 8ffb18672c9f526930ce39afa369ba284977f2ce2fea8a3de4a838ae583926535d9baea13862c6c3fb9f53178b4e9545cb9c2c135e59138ef9d4632517c4ac75
7
- data.tar.gz: ebe24a6c5852a53e6c6b1c3606f1c8f88585ad33461bd585d35b987377a35f8c5f60812c8200de64d6eca08137d6d0c57febc0b12b23cfdb568f8a05a4f0db35
6
+ metadata.gz: d8434a65a80f738284ef000006ade5cc3fe5e3adbd1e9888db261ec927f2060dc39fc3f68b07d9fcafa975f593c8bd1f70130ce5dc0f26888f69b8bacb8d32bf
7
+ data.tar.gz: c7be66ee3385b68b49bfbae72880656067030532211d670905f0618bc973dba39e1ade8ace0f8d243d63e78932898fc631a687a2f7f2b42fa1db33d87f0a8cde
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.1
2
+
3
+ Enhancements:
4
+
5
+ * Support `startsWith`, `endsWith`, `contains` string operators
6
+
1
7
  # 0.1.0
2
8
 
3
9
  first version
data/README.md CHANGED
@@ -10,7 +10,7 @@ A filter plugin for Embulk to filter out rows
10
10
  * boolean operator
11
11
  * ==
12
12
  * !=
13
- * numeric operator
13
+ * numeric operator (long, double, Timestamp)
14
14
  * ==
15
15
  * !=
16
16
  * >
@@ -20,16 +20,16 @@ A filter plugin for Embulk to filter out rows
20
20
  * string operator
21
21
  * ==
22
22
  * !=
23
- * start_with
24
- * end_with
25
- * include
23
+ * start_with (or startsWith)
24
+ * end_with (or endsWith)
25
+ * include (or contains)
26
26
  * unary operator
27
27
  * "IS NULL"
28
28
  * "IS NOT NULL"
29
29
  * **argument**: argument for the operation (string, required for non-unary operators)
30
30
  * **not**: not (boolean, optional, default: false)
31
- * **format**: special option for timestamp column. (string, default is `%Y-%m-%d %H:%M:%S.%N %z`)
32
- * **timezone**: special option for timestamp column. (string, default is `UTC`)
31
+ * **format**: special option for timestamp column, specify the format of timestamp argument (string, default is `%Y-%m-%d %H:%M:%S.%N %z`)
32
+ * **timezone**: special option for timestamp column, specify the timezone of timestamp argument (string, default is `UTC`)
33
33
 
34
34
  NOTE: column type is automatically retrieved from input data (inputSchema)
35
35
 
@@ -42,7 +42,7 @@ filters:
42
42
  - {column: foo, operator: "IS NOT NULL"}
43
43
  - {column: id, operator: ">=", argument: 10}
44
44
  - {column: id, operator: "<", argument: 20}
45
- - {column: name, opeartor: "==", argument: foo, not: true}
45
+ - {column: name, opeartor: "include", argument: foo, not: true}
46
46
  - {column: time, operator: "==", argument: "2015-07-13", format: "%Y-%m-%d"}
47
47
  ```
48
48
 
data/build.gradle CHANGED
@@ -12,7 +12,7 @@ configurations {
12
12
  provided
13
13
  }
14
14
 
15
- version = "0.1.0"
15
+ version = "0.1.1"
16
16
 
17
17
  dependencies {
18
18
  compile "org.embulk:embulk-core:0.6.16"
@@ -53,8 +53,8 @@ Gem::Specification.new do |spec|
53
53
  spec.name = "${project.name}"
54
54
  spec.version = "${project.version}"
55
55
  spec.authors = ["Naotoshi Seo"]
56
- spec.summary = %[A filter plugin for Embulk to filter out rows]
57
- spec.description = %[A filter plugin for Embulk to filter out rows.]
56
+ spec.summary = %[A filter plugin for Embulk to filter out rows with conditions]
57
+ spec.description = %[A filter plugin for Embulk to filter out rows with conditions.]
58
58
  spec.email = ["sonots@gmail.com"]
59
59
  spec.licenses = ["MIT"]
60
60
  spec.homepage = "https://github.com/sonots/embulk-filter-row"
@@ -13,16 +13,19 @@ public class StringCondition implements Condition
13
13
  StringComparator comparator;
14
14
  switch (operator.toUpperCase()) {
15
15
  case "START_WITH":
16
+ case "STARTSWITH":
16
17
  comparator = (String subject) -> {
17
18
  return subject == null ? false : subject.startsWith(argument);
18
19
  };
19
20
  break;
20
21
  case "END_WITH":
22
+ case "ENDSWITH":
21
23
  comparator = (String subject) -> {
22
24
  return subject == null ? false : subject.endsWith(argument);
23
25
  };
24
26
  break;
25
27
  case "INCLUDE":
28
+ case "CONTAINS":
26
29
  comparator = (String subject) -> {
27
30
  return subject == null ? false : subject.contains(argument);
28
31
  };
@@ -47,6 +47,14 @@ public class TestStringCondition
47
47
  assertFalse(condition.compare("bar"));
48
48
  }
49
49
 
50
+ @Test
51
+ public void testStartsWith() {
52
+ StringCondition condition = new StringCondition("startsWith", "f", false);
53
+ assertFalse(condition.compare(null));
54
+ assertTrue( condition.compare("foo"));
55
+ assertFalse(condition.compare("bar"));
56
+ }
57
+
50
58
  @Test
51
59
  public void testEndWith() {
52
60
  StringCondition condition = new StringCondition("end_with", "o", false);
@@ -55,6 +63,14 @@ public class TestStringCondition
55
63
  assertFalse(condition.compare("bar"));
56
64
  }
57
65
 
66
+ @Test
67
+ public void testEndsWith() {
68
+ StringCondition condition = new StringCondition("endsWith", "o", false);
69
+ assertFalse(condition.compare(null));
70
+ assertTrue( condition.compare("foo"));
71
+ assertFalse(condition.compare("bar"));
72
+ }
73
+
58
74
  @Test
59
75
  public void testInclude() {
60
76
  StringCondition condition = new StringCondition("include", "o", false);
@@ -63,6 +79,14 @@ public class TestStringCondition
63
79
  assertFalse(condition.compare("bar"));
64
80
  }
65
81
 
82
+ @Test
83
+ public void testContains() {
84
+ StringCondition condition = new StringCondition("contains", "o", false);
85
+ assertFalse(condition.compare(null));
86
+ assertTrue( condition.compare("foo"));
87
+ assertFalse(condition.compare("bar"));
88
+ }
89
+
66
90
  @Test
67
91
  public void testNot() {
68
92
  StringCondition condition = new StringCondition("include", "o", true);
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.1.0
4
+ version: 0.1.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: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: A filter plugin for Embulk to filter out rows.
41
+ description: A filter plugin for Embulk to filter out rows with conditions.
42
42
  email:
43
43
  - sonots@gmail.com
44
44
  executables: []
@@ -72,7 +72,7 @@ files:
72
72
  - src/test/java/org/embulk/filter/row/TestLongCondition.java
73
73
  - src/test/java/org/embulk/filter/row/TestStringCondition.java
74
74
  - src/test/java/org/embulk/filter/row/TestTimestampCondition.java
75
- - classpath/embulk-filter-row-0.1.0.jar
75
+ - classpath/embulk-filter-row-0.1.1.jar
76
76
  homepage: https://github.com/sonots/embulk-filter-row
77
77
  licenses:
78
78
  - MIT
@@ -96,5 +96,5 @@ rubyforge_project:
96
96
  rubygems_version: 2.1.9
97
97
  signing_key:
98
98
  specification_version: 4
99
- summary: A filter plugin for Embulk to filter out rows
99
+ summary: A filter plugin for Embulk to filter out rows with conditions
100
100
  test_files: []