embulk-filter-timestamp_format 0.2.1 → 0.2.3

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: fb300296d9f472df63c5d7f3bf6c7b2fadbf730d
4
- data.tar.gz: d50abbc10df9eb9723c33b6b27f420d789fdfd6c
3
+ metadata.gz: 7a2a594a84f03137480454f65b2ee9f5e3bbc58a
4
+ data.tar.gz: 836fb23b2550507518b6f2de9ca77b3220e09457
5
5
  SHA512:
6
- metadata.gz: 7a275c35383b7e607ffdc69335c36c9087f5db8ae1aaf10d6af5cb0a71407a5f82d40b999b46722bd0ae28806c53392c815ac93f7fefc842bec6c77a126de51c
7
- data.tar.gz: 980e5f1414dca7036618ecc8d50d5559a28882d2f02cdd60ce56ee4959bc49476aa206b3a9714cb889f211ffe1eb3db89380ecf553c16a106640a0659ec15430
6
+ metadata.gz: b7deb792bec505f3cd70e0e191d98473d383d4f58dddba199dad285c47f0cf2fb003fb2e8face50336bfb9577e769b7d673fa99e2ce4be2a21269a0a2b0cb831
7
+ data.tar.gz: 0135e7bca5a55b62b31e6768e3b1a7e3e4ebfa1caa66bd289187d1a8fdd512bd270041d626205a10bad1d6abe33e36834a87aea3da3cca93e52cff6c2325ae1d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.2.3 (2016-10-25)
2
+
3
+ Fixes:
4
+
5
+ * Fix the case of top-level array such as `$.array_timestamp[*]`
6
+
7
+ # 0.2.2 (2016-10-07)
8
+
9
+ yanked
10
+
1
11
  # 0.2.1 (2016-05-19)
2
12
 
3
13
  Enhancements:
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.2.1"
16
+ version = "0.2.3"
17
17
  sourceCompatibility = 1.7
18
18
  targetCompatibility = 1.7
19
19
 
@@ -50,7 +50,8 @@ public class ColumnVisitorImpl
50
50
  String name = columnConfig.getName();
51
51
  if (name.startsWith("$.")) {
52
52
  String firstName = name.split("\\.", 3)[1]; // check only top level column name
53
- shouldCastSet.add(firstName);
53
+ String firstPartName = firstName.split("\\[")[0];
54
+ shouldCastSet.add(firstPartName);
54
55
  continue;
55
56
  }
56
57
  shouldCastSet.add(name);
@@ -78,9 +78,9 @@ public class JsonVisitor
78
78
  return shouldVisitSet.contains(jsonPath);
79
79
  }
80
80
 
81
- public Value visit(String jsonPath, Value value)
81
+ public Value visit(String rootPath, Value value)
82
82
  {
83
- if (!shouldVisit(jsonPath)) {
83
+ if (!shouldVisit(rootPath)) {
84
84
  return value;
85
85
  }
86
86
  if (value.isArrayValue()) {
@@ -88,9 +88,9 @@ public class JsonVisitor
88
88
  int size = arrayValue.size();
89
89
  Value[] newValue = new Value[size];
90
90
  for (int i = 0; i < size; i++) {
91
- String k = new StringBuilder(jsonPath).append("[").append(Integer.toString(i)).append("]").toString();
91
+ String k = new StringBuilder(rootPath).append("[").append(Integer.toString(i)).append("]").toString();
92
92
  if (!shouldVisit(k)) {
93
- k = new StringBuilder(jsonPath).append("[*]").toString(); // try [*] too
93
+ k = new StringBuilder(rootPath).append("[*]").toString(); // try [*] too
94
94
  }
95
95
  Value v = arrayValue.get(i);
96
96
  newValue[i] = visit(k, v);
@@ -105,7 +105,7 @@ public class JsonVisitor
105
105
  for (Map.Entry<Value, Value> entry : mapValue.entrySet()) {
106
106
  Value k = entry.getKey();
107
107
  Value v = entry.getValue();
108
- String newPath = new StringBuilder(jsonPath).append(".").append(k.asStringValue().asString()).toString();
108
+ String newPath = new StringBuilder(rootPath).append(".").append(k.asStringValue().asString()).toString();
109
109
  Value r = visit(newPath, v);
110
110
  newValue[i++] = k;
111
111
  newValue[i++] = r;
@@ -113,15 +113,15 @@ public class JsonVisitor
113
113
  return ValueFactory.newMap(newValue, true);
114
114
  }
115
115
  else if (value.isIntegerValue()) {
116
- ColumnConfig columnConfig = jsonPathColumnConfigMap.get(jsonPath);
116
+ ColumnConfig columnConfig = jsonPathColumnConfigMap.get(rootPath);
117
117
  return jsonCaster.fromLong(columnConfig, value.asIntegerValue());
118
118
  }
119
119
  else if (value.isFloatValue()) {
120
- ColumnConfig columnConfig = jsonPathColumnConfigMap.get(jsonPath);
120
+ ColumnConfig columnConfig = jsonPathColumnConfigMap.get(rootPath);
121
121
  return jsonCaster.fromDouble(columnConfig, value.asFloatValue());
122
122
  }
123
123
  else if (value.isStringValue()) {
124
- ColumnConfig columnConfig = jsonPathColumnConfigMap.get(jsonPath);
124
+ ColumnConfig columnConfig = jsonPathColumnConfigMap.get(rootPath);
125
125
  return jsonCaster.fromString(columnConfig, value.asStringValue());
126
126
  }
127
127
  else {
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-timestamp_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
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-19 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: '1.0'
19
+ name: bundler
25
20
  prerelease: false
26
21
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '10.0'
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '10.0'
33
+ name: rake
39
34
  prerelease: false
40
35
  type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
41
  description: A filter plugin for Embulk to change timestamp format.
42
42
  email:
43
43
  - sonots@gmail.com
@@ -102,7 +102,7 @@ files:
102
102
  - src/main/java/org/embulk/filter/timestamp_format/cast/TimestampCast.java
103
103
  - src/test/java/org/embulk/filter/timestamp_format/TestTimestampFormatConverter.java
104
104
  - src/test/java/org/embulk/filter/timestamp_format/TestTimestampUnit.java
105
- - classpath/embulk-filter-timestamp_format-0.2.1.jar
105
+ - classpath/embulk-filter-timestamp_format-0.2.3.jar
106
106
  homepage: https://github.com/sonots/embulk-filter-timestamp_format
107
107
  licenses:
108
108
  - MIT