embulk-filter-column 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +30 -6
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/filter/column/JsonColumn.java +3 -0
- data/src/test/java/org/embulk/filter/column/TestJsonVisitor.java +14 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cad32bb6df05ff04fb0501b8b893812d999969e
|
4
|
+
data.tar.gz: 7c0047d6f7dc5542195abd36a63e50aebdaa405a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da990ff7ca9e14bbb7e385998309a979ef8376b3c25d8a117296ea121c82a91bf7cca8ee18439cf3b895b83a54901e37bcb6696ae618d4ee1c71755c1b92fc2
|
7
|
+
data.tar.gz: dbb3eb97dc117998562791b05ff846078be14cc365f754312e575ad8d0a576fe6575c3c471c6d55cd7fa8884146191cf56faa7e3b0f6a519c8f14d855ab23158
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -114,9 +114,9 @@ C40P5H1WcBx-aWFDJCI8th6QPEI2DOUgupt_gB8UutE,7323
|
|
114
114
|
For type: json column, you can specify [JSONPath](http://goessner.net/articles/JsonPath/) for column's name as:
|
115
115
|
|
116
116
|
```
|
117
|
-
$.payload.key1
|
118
|
-
$.payload.array[0]
|
119
|
-
$.payload.array[*]
|
117
|
+
- {name: $.payload.key1}
|
118
|
+
- {name: "$.payload.array[0]"}
|
119
|
+
- {name: "$.payload.array[*]"}
|
120
120
|
```
|
121
121
|
|
122
122
|
EXAMPLE:
|
@@ -128,9 +128,33 @@ EXAMPLE:
|
|
128
128
|
NOTE:
|
129
129
|
|
130
130
|
* JSONPath syntax is not fully supported
|
131
|
-
*
|
132
|
-
|
133
|
-
|
131
|
+
* `type: timesatmp` for `add_columns` or `columns` is not available because Embulk's `type: json` cannot have timestamp column
|
132
|
+
|
133
|
+
NOTE:
|
134
|
+
|
135
|
+
To deeply visit json path such as `$.payload.foo.bar`, you have to write its upper paths together like:
|
136
|
+
|
137
|
+
```
|
138
|
+
- (name: $.payload.foo}
|
139
|
+
- {name: $.payload.foo.bar}
|
140
|
+
```
|
141
|
+
|
142
|
+
NOTE:
|
143
|
+
|
144
|
+
`src` (to rename or copy columns) is only partially supported yet. The upper json path must be same like:
|
145
|
+
|
146
|
+
```
|
147
|
+
- {name: $.payload.foo}
|
148
|
+
- {name: $.payload.foo.dest, src: $.payload.foo.src}
|
149
|
+
```
|
150
|
+
|
151
|
+
Below does not work yet.
|
152
|
+
|
153
|
+
```
|
154
|
+
- {name: $.payload.foo}
|
155
|
+
- {name: $.payload.bar}
|
156
|
+
- {name: $.payload.foo.dest, src: $.payload.bar.src}
|
157
|
+
```
|
134
158
|
|
135
159
|
## ToDo
|
136
160
|
|
data/build.gradle
CHANGED
@@ -47,6 +47,9 @@ public class JsonColumn
|
|
47
47
|
this.pathValue = ValueFactory.newString(path);
|
48
48
|
this.parentPath = parentPath(path);
|
49
49
|
this.baseName = baseName(path);
|
50
|
+
if (this.baseName.equals("[*]")) {
|
51
|
+
throw new ConfigException(String.format("%s wrongly ends with [*], perhaps you can remove the [*]", path));
|
52
|
+
}
|
50
53
|
this.baseIndex = baseIndex(path);
|
51
54
|
this.parentPathValue = ValueFactory.newString(parentPath);
|
52
55
|
this.baseNameValue = ValueFactory.newString(baseName);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package org.embulk.filter.column;
|
2
2
|
|
3
|
+
import org.embulk.config.ConfigException;
|
3
4
|
import org.embulk.EmbulkTestRuntime;
|
4
5
|
import org.embulk.config.ConfigLoader;
|
5
6
|
import org.embulk.config.ConfigSource;
|
@@ -55,6 +56,18 @@ public class TestJsonVisitor
|
|
55
56
|
return new JsonVisitor(task, inputSchema, outputSchema);
|
56
57
|
}
|
57
58
|
|
59
|
+
@Test(expected = ConfigException.class)
|
60
|
+
public void configException_Columns()
|
61
|
+
{
|
62
|
+
PluginTask task = taskFromYamlString(
|
63
|
+
"type: column",
|
64
|
+
"columns:",
|
65
|
+
" - {name: \"$.json1.b.b[*]\"}");
|
66
|
+
Schema inputSchema = Schema.builder().build();
|
67
|
+
// b[*] should be written as b
|
68
|
+
jsonVisitor(task, inputSchema);
|
69
|
+
}
|
70
|
+
|
58
71
|
@Test
|
59
72
|
public void buildShouldVisitSet()
|
60
73
|
{
|
@@ -311,7 +324,7 @@ public class TestJsonVisitor
|
|
311
324
|
"type: column",
|
312
325
|
"drop_columns:",
|
313
326
|
" - {name: \"$.json1.k1[0].k1\"}",
|
314
|
-
" - {name: \"$.json1.k2[*]\"}");
|
327
|
+
" - {name: \"$.json1.k2[*]\"}"); // ending with [*] is allowed for drop_columns, but not for others
|
315
328
|
Schema inputSchema = Schema.builder()
|
316
329
|
.add("json1", JSON)
|
317
330
|
.add("json2", JSON)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-column
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,7 +71,7 @@ files:
|
|
71
71
|
- src/test/java/org/embulk/filter/column/TestColumnVisitorImpl.java
|
72
72
|
- src/test/java/org/embulk/filter/column/TestJsonColumn.java
|
73
73
|
- src/test/java/org/embulk/filter/column/TestJsonVisitor.java
|
74
|
-
- classpath/embulk-filter-column-0.5.
|
74
|
+
- classpath/embulk-filter-column-0.5.4.jar
|
75
75
|
homepage: https://github.com/sonots/embulk-filter-column
|
76
76
|
licenses:
|
77
77
|
- MIT
|