embulk-filter-timestamp_format 0.2.0 → 0.2.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: 6c2034a4c12e1d4439ed09e907953e99ebca2ab7
4
- data.tar.gz: 042b74ef4661bb9c1a629178df7e13c76bab03db
3
+ metadata.gz: fb300296d9f472df63c5d7f3bf6c7b2fadbf730d
4
+ data.tar.gz: d50abbc10df9eb9723c33b6b27f420d789fdfd6c
5
5
  SHA512:
6
- metadata.gz: eda3234fc719296056ee7640dcf889dc9af2230f14db52c0bb1678d5a08f709a938bd7a8fbf796ce740a64d22f6a7bf7f7a2930a83b2d30152321e1fd485fc7a
7
- data.tar.gz: dc28a057caaf95736d2667542253850d569f00ac2fb9181b4d9526e903a0842eefaca635ce2a41f1b5adc00863f21c3443f89905ff1da9848c8d4f2e897d8f38
6
+ metadata.gz: 7a275c35383b7e607ffdc69335c36c9087f5db8ae1aaf10d6af5cb0a71407a5f82d40b999b46722bd0ae28806c53392c815ac93f7fefc842bec6c77a126de51c
7
+ data.tar.gz: 980e5f1414dca7036618ecc8d50d5559a28882d2f02cdd60ce56ee4959bc49476aa206b3a9714cb889f211ffe1eb3db89380ecf553c16a106640a0659ec15430
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.2.1 (2016-05-19)
2
+
3
+ Enhancements:
4
+
5
+ * Support JSONPath array wildcard
6
+
1
7
  # 0.2.0 (2016-05-13)
2
8
 
3
9
  Enhancements:
data/README.md CHANGED
@@ -63,6 +63,18 @@ Output will be as:
63
63
 
64
64
  See [./example](./example) for more examples.
65
65
 
66
+ ## JSONPath (like) name
67
+
68
+ For `type: json` column, you can specify [JSONPath](http://goessner.net/articles/JsonPath/) for column's name as:
69
+
70
+ ```
71
+ $.payload.key1
72
+ $.payload.array[0]
73
+ $.payload.array[*]
74
+ ```
75
+
76
+ NOTE: JSONPath syntax is not fully supported
77
+
66
78
  ## JRuby Timestamp Parser Performance Issue
67
79
 
68
80
  Embulk's timestamp parser originally uses jruby implementation, but it is slow.
@@ -91,9 +103,9 @@ out:
91
103
 
92
104
  If format strings contain `%`, jruby parser/formatter is used. Otherwirse, java parser/formatter is used
93
105
 
94
- **Auto Java timestamp format conversion** (experimental)
106
+ **Automatic Conversion of Ruby Timestamp Format to Java Timestamp Format** (experimental)
95
107
 
96
- If you configure `timestamp_parser: auto_java`, this plugin tries to convert ruby format into java format to use faster java timestamp parser.
108
+ If you configure `timestamp_parser: auto_java`, this plugin tries to convert ruby format into java format automatically to use faster java timestamp parser.
97
109
 
98
110
  **COMPARISON:**
99
111
 
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.2.0"
16
+ version = "0.2.1"
17
17
  sourceCompatibility = 1.7
18
18
  targetCompatibility = 1.7
19
19
 
data/settings.gradle ADDED
@@ -0,0 +1 @@
1
+ rootProject.name = 'embulk-filter-timestamp_format'
@@ -60,6 +60,7 @@ public class JsonVisitor
60
60
  partialPath.append(".").append(arrayParts[0]);
61
61
  this.shouldVisitSet.add(partialPath.toString());
62
62
  for (int j = 1; j < arrayParts.length; j++) {
63
+ // Support both [0] and [*]
63
64
  partialPath.append("[").append(arrayParts[j]);
64
65
  this.shouldVisitSet.add(partialPath.toString());
65
66
  }
@@ -88,6 +89,9 @@ public class JsonVisitor
88
89
  Value[] newValue = new Value[size];
89
90
  for (int i = 0; i < size; i++) {
90
91
  String k = new StringBuilder(jsonPath).append("[").append(Integer.toString(i)).append("]").toString();
92
+ if (!shouldVisit(k)) {
93
+ k = new StringBuilder(jsonPath).append("[*]").toString(); // try [*] too
94
+ }
91
95
  Value v = arrayValue.get(i);
92
96
  newValue[i] = visit(k, v);
93
97
  }
@@ -101,7 +101,8 @@ public class TimestampFormatFilterPlugin implements FilterPlugin
101
101
  String name = columnConfig.getName();
102
102
  if (name.startsWith("$.")) {
103
103
  String firstName = name.split("\\.", 3)[1]; // check only top level column name
104
- inputSchema.lookupColumn(firstName);
104
+ String firstNameWithoutArray = firstName.split("\\[")[0];
105
+ inputSchema.lookupColumn(firstNameWithoutArray);
105
106
  }
106
107
  else {
107
108
  inputSchema.lookupColumn(name);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-timestamp_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.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: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - gradlew
86
86
  - gradlew.bat
87
87
  - lib/embulk/filter/timestamp_format.rb
88
+ - settings.gradle
88
89
  - src/main/java/org/embulk/filter/timestamp_format/ColumnCaster.java
89
90
  - src/main/java/org/embulk/filter/timestamp_format/ColumnVisitorImpl.java
90
91
  - src/main/java/org/embulk/filter/timestamp_format/JsonCaster.java
@@ -101,7 +102,7 @@ files:
101
102
  - src/main/java/org/embulk/filter/timestamp_format/cast/TimestampCast.java
102
103
  - src/test/java/org/embulk/filter/timestamp_format/TestTimestampFormatConverter.java
103
104
  - src/test/java/org/embulk/filter/timestamp_format/TestTimestampUnit.java
104
- - classpath/embulk-filter-timestamp_format-0.2.0.jar
105
+ - classpath/embulk-filter-timestamp_format-0.2.1.jar
105
106
  homepage: https://github.com/sonots/embulk-filter-timestamp_format
106
107
  licenses:
107
108
  - MIT