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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b597e430acd8f39ad24000c423fc00ad0396b84c
4
- data.tar.gz: 1ab18bcd72e1e49d9aaf65f7343a11b9421e61ae
3
+ metadata.gz: 0cad32bb6df05ff04fb0501b8b893812d999969e
4
+ data.tar.gz: 7c0047d6f7dc5542195abd36a63e50aebdaa405a
5
5
  SHA512:
6
- metadata.gz: 53d313c43ce6557672c2e4c78782a7089132fb87c9942210d4dd18844f143e3a046f4cb0b8561101100406e0a5df6351652b4afa18ff14ebde30cf818495cad6
7
- data.tar.gz: ba2fb51e24bf1925ce078e545bf143345324b6ad332c96fa0184bc0a98b639d4df8d911ea3d3f84fa61c27c8458952a8f7c77f9813b850af4b3205548c6cecc0
6
+ metadata.gz: 1da990ff7ca9e14bbb7e385998309a979ef8376b3c25d8a117296ea121c82a91bf7cca8ee18439cf3b895b83a54901e37bcb6696ae618d4ee1c71755c1b92fc2
7
+ data.tar.gz: dbb3eb97dc117998562791b05ff846078be14cc365f754312e575ad8d0a576fe6575c3c471c6d55cd7fa8884146191cf56faa7e3b0f6a519c8f14d855ab23158
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.5.4 (2016-08-05)
2
+
3
+ Enhancements:
4
+
5
+ * raise ConfigException if json path ends with `[*]` (columns and add_columns)
6
+
1
7
  # 0.5.3 (2016-06-21)
2
8
 
3
9
  Changes:
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
- * Embulk's type: json cannot have timestamp column, so `type: timesatmp` for `add_columns` or `columns` with default is not available
132
- * `src` (to rename or copy columns) for `add_columns` or `columns` is only partially supported yet
133
- * the json path directory must be same, for example, `{name: $.foo.copy, src: $foo.bar}` works, but `{name: $foo.copy, src: $.bar.baz}` does not work
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
@@ -15,7 +15,7 @@ configurations {
15
15
  provided
16
16
  }
17
17
 
18
- version = "0.5.3"
18
+ version = "0.5.4"
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
21
21
 
@@ -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.3
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-06-21 00:00:00.000000000 Z
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.3.jar
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