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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -2
- data/build.gradle +1 -1
- data/settings.gradle +1 -0
- data/src/main/java/org/embulk/filter/timestamp_format/JsonVisitor.java +4 -0
- data/src/main/java/org/embulk/filter/timestamp_format/TimestampFormatFilterPlugin.java +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb300296d9f472df63c5d7f3bf6c7b2fadbf730d
|
4
|
+
data.tar.gz: d50abbc10df9eb9723c33b6b27f420d789fdfd6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a275c35383b7e607ffdc69335c36c9087f5db8ae1aaf10d6af5cb0a71407a5f82d40b999b46722bd0ae28806c53392c815ac93f7fefc842bec6c77a126de51c
|
7
|
+
data.tar.gz: 980e5f1414dca7036618ecc8d50d5559a28882d2f02cdd60ce56ee4959bc49476aa206b3a9714cb889f211ffe1eb3db89380ecf553c16a106640a0659ec15430
|
data/CHANGELOG.md
CHANGED
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
|
-
**
|
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
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
|
-
|
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.
|
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-
|
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.
|
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
|