embulk-filter-row 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +11 -2
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/filter/row/RowFilterPlugin.java +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5339052a179409622158694483a27d6ab80f4a80
|
4
|
+
data.tar.gz: 0460d1d3511ca884042e60465b40d6a8d5e41bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b12e47564da7eabd58733723e463ac1da4523795905a19f9583839b5c3a51f2ea56230ea564d452d75c8bbf125a724497f462f4f0213ba6e82a250fa7ea4d92
|
7
|
+
data.tar.gz: b133c708497f4e78f09b35b35b8f11bb06d48bdf5ac5abe61ab7f9261d63abe98bb942a4c5f0bd55500516fb0076b0e7c35bbec59cf64da275999bc0fa23c5d0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,10 @@ A filter plugin for Embulk to filter out rows
|
|
6
6
|
|
7
7
|
## Configuration
|
8
8
|
|
9
|
+
* **where**: Write conditions with SQL-like syntax. See [SQL-like Syntax](#sql-like-syntax)
|
10
|
+
|
11
|
+
Following options are **deprecated**, and will be removed someday.
|
12
|
+
|
9
13
|
* **condition**: AND or OR (string, default: AND).
|
10
14
|
* **conditions**: select only rows which matches with conditions.
|
11
15
|
* **column**: column name (string, required)
|
@@ -33,12 +37,13 @@ A filter plugin for Embulk to filter out rows
|
|
33
37
|
* **not**: not (boolean, optional, default: false)
|
34
38
|
* **format**: special option for timestamp column, specify the format of timestamp argument, parsed argument is compared with the column value as Timestamp object (string, default is `%Y-%m-%d %H:%M:%S.%N %z`)
|
35
39
|
* **timezone**: special option for timestamp column, specify the timezone of timestamp argument (string, default is `UTC`)
|
36
|
-
* **where** (experimental): Write conditions with SQL-like syntax. See [SQL-like Syntax](#sql-like-syntax)
|
37
40
|
|
38
41
|
NOTE: column type is automatically retrieved from input data (inputSchema)
|
39
42
|
|
40
43
|
## Example (AND)
|
41
44
|
|
45
|
+
**Deprecated**
|
46
|
+
|
42
47
|
```yaml
|
43
48
|
filters:
|
44
49
|
- type: row
|
@@ -53,6 +58,8 @@ filters:
|
|
53
58
|
|
54
59
|
## Example (OR)
|
55
60
|
|
61
|
+
**Deprecated**
|
62
|
+
|
56
63
|
```yaml
|
57
64
|
filters:
|
58
65
|
- type: row
|
@@ -64,6 +71,8 @@ filters:
|
|
64
71
|
|
65
72
|
## Example (AND of OR)
|
66
73
|
|
74
|
+
**Deprecated**
|
75
|
+
|
67
76
|
You can express a condition such as `(A OR B) AND (C OR D)` by combining multiple filters like
|
68
77
|
|
69
78
|
```yaml
|
@@ -80,7 +89,7 @@ filters:
|
|
80
89
|
- {column: d, operator: "IS NOT NULL"}
|
81
90
|
```
|
82
91
|
|
83
|
-
## Example (WHERE)
|
92
|
+
## Example (WHERE)
|
84
93
|
|
85
94
|
Versions >= 0.3.0 suppors SQL-like syntax like
|
86
95
|
|
data/build.gradle
CHANGED
@@ -30,7 +30,6 @@ import java.util.List;
|
|
30
30
|
public class RowFilterPlugin implements FilterPlugin
|
31
31
|
{
|
32
32
|
private static final Logger logger = Exec.getLogger(RowFilterPlugin.class);
|
33
|
-
private ParserExp parserExp = null;
|
34
33
|
|
35
34
|
public RowFilterPlugin() {}
|
36
35
|
|
@@ -38,10 +37,12 @@ public class RowFilterPlugin implements FilterPlugin
|
|
38
37
|
{
|
39
38
|
@Config("condition")
|
40
39
|
@ConfigDefault("\"AND\"")
|
40
|
+
@Deprecated
|
41
41
|
public String getCondition();
|
42
42
|
|
43
43
|
@Config("conditions")
|
44
44
|
@ConfigDefault("null")
|
45
|
+
@Deprecated
|
45
46
|
public Optional<List<ConditionConfig>> getConditions();
|
46
47
|
|
47
48
|
@Config("where")
|
@@ -65,6 +66,7 @@ public class RowFilterPlugin implements FilterPlugin
|
|
65
66
|
void configure(PluginTask task, Schema inputSchema) throws ConfigException
|
66
67
|
{
|
67
68
|
if (task.getConditions().isPresent()) {
|
69
|
+
logger.warn("embulk-filter-row: \"conditions\" is deprecated, use \"where\" instead.");
|
68
70
|
for (ConditionConfig conditionConfig : task.getConditions().get()) {
|
69
71
|
String columnName = conditionConfig.getColumn();
|
70
72
|
inputSchema.lookupColumn(columnName); // throw SchemaConfigException if not found
|
@@ -78,7 +80,8 @@ public class RowFilterPlugin implements FilterPlugin
|
|
78
80
|
else if (task.getWhere().isPresent()) {
|
79
81
|
String where = task.getWhere().get();
|
80
82
|
Parser parser = new Parser(inputSchema);
|
81
|
-
|
83
|
+
// objects must be created in open since plugin instances in transaction and open are different
|
84
|
+
parser.parse(where); // throws ConfigException if something wrong
|
82
85
|
}
|
83
86
|
else {
|
84
87
|
throw new ConfigException("Either of `conditions` or `where` must be set.");
|
@@ -96,6 +99,7 @@ public class RowFilterPlugin implements FilterPlugin
|
|
96
99
|
|
97
100
|
final AbstractGuardColumnVisitor guradVisitor;
|
98
101
|
if (task.getWhere().isPresent()) {
|
102
|
+
ParserExp parserExp = new Parser(inputSchema).parse(task.getWhere().get());
|
99
103
|
guradVisitor = new GuardColumnVisitorWhereImpl(task, inputSchema, outputSchema, pageReader, parserExp);
|
100
104
|
}
|
101
105
|
else if (orCondition) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-row
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- src/test/java/org/embulk/filter/row/condition/TestTimestampCondition.java
|
95
95
|
- src/test/java/org/embulk/filter/row/where/TestParser.java
|
96
96
|
- src/test/java/org/embulk/filter/row/where/TestYylex.java
|
97
|
-
- classpath/embulk-filter-row-0.3.
|
97
|
+
- classpath/embulk-filter-row-0.3.2.jar
|
98
98
|
homepage: https://github.com/sonots/embulk-filter-row
|
99
99
|
licenses:
|
100
100
|
- MIT
|