embulk-filter-add_time 0.1.0 → 0.1.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: 8d4e2b549cb21e8c80956270dffd3a7d3fde0a96
4
- data.tar.gz: da794c2b1309cf71015a035876eb142e0056dfdb
3
+ metadata.gz: 47c3533da9505293335ec892ae49e06b462f3b39
4
+ data.tar.gz: 3332208c1f09e1b0da0d2d9638730083f679159d
5
5
  SHA512:
6
- metadata.gz: 14cff8010192c946d9349fe1d22198784205f4ddbc8d4537b2b9ceb98269553abeeff028fea808300a7c13489ddded45966ea39e81add2835cf36b474bbe9e6e
7
- data.tar.gz: 66d5eada349e6502a170d05236d4f92223083b131a424bb3b946d856b5462523b19d923df03c2b73e60646e57995f0da3aa2977e4d268d108d364d6934feb0d7
6
+ metadata.gz: bcd078c499649c2ae4be4e2c527626058cf9cad68511385e269535b25835dde192e2744340014eef1833aaeb1848e31d0c1447c6af8286641d935e7795ec91aa
7
+ data.tar.gz: 64cfc9c742ff32955508ffe75dd8a83e393102bcb6c80db7b45bf0869a5e6b5863d0d34e8694d596c5e12ff157c60256e1d807e731ef6707fe11b3d755e3adfb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.1 - 2016-02-05
2
+
3
+ * [maintenance] Throw ConfigException if from_column doesn't exist in input schema [#5](https://github.com/treasure-data/embulk-filter-add_time/pull/5)
4
+
1
5
  ## 0.1.0 - 2016-01-28
2
6
 
3
7
  The first release!!
data/build.gradle CHANGED
@@ -15,7 +15,7 @@ configurations {
15
15
  provided
16
16
  }
17
17
 
18
- version = "0.1.0"
18
+ version = "0.1.1"
19
19
 
20
20
  compileJava.options.encoding = 'UTF-8' // source encoding
21
21
  sourceCompatibility = 1.7
@@ -50,6 +50,9 @@ public class SchemaConverter
50
50
  if (!fromColumnConfig.isPresent() && !fromValueConfig.isPresent()) {
51
51
  throw new ConfigException("Setting from_column or from_value is required.");
52
52
  }
53
+ if (fromColumnConfig.isPresent() && !hasColumn(fromColumnConfig.get().getName(), inputSchema)) {
54
+ throw new ConfigException(String.format("from_column '%s' doesn't exist in the schema.", fromColumnConfig.get().getName()));
55
+ }
53
56
 
54
57
  converters = new ColumnConverter[inputSchema.size() + 1];
55
58
 
@@ -102,6 +105,16 @@ public class SchemaConverter
102
105
  }
103
106
  }
104
107
 
108
+ private static boolean hasColumn(String columnName, Schema schema)
109
+ {
110
+ for (Column c : schema.getColumns()) {
111
+ if (c.getName().equals(columnName)) {
112
+ return true;
113
+ }
114
+ }
115
+ return false;
116
+ }
117
+
105
118
  private static String newColumnUniqueName(String originalName, Schema schema)
106
119
  {
107
120
  String name = originalName;
@@ -61,6 +61,14 @@ public class TestSchemaConverter
61
61
  failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
62
62
  }
63
63
 
64
+ // the column specified as from_column doesn't exist in the schema, throws ConfigException
65
+ {
66
+ ConfigSource conf = this.config.deepCopy()
67
+ .set("to_column", ImmutableMap.of("name", "time"))
68
+ .set("from_column", ImmutableMap.of("name", "c1"));;
69
+ failSchemaConverterCreation(log, conf, schema("c0", Types.TIMESTAMP));
70
+ }
71
+
64
72
  // if from_value type is not string or long, throws ConfigException
65
73
  {
66
74
  ConfigSource conf = this.config.deepCopy()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-add_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muga Nishizawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,7 @@ files:
79
79
  - src/main/java/org/embulk/filter/add_time/reader/TimestampColumnReader.java
80
80
  - src/test/java/org/embulk/filter/add_time/TestAddTimeFilterPlugin.java
81
81
  - src/test/java/org/embulk/filter/add_time/converter/TestSchemaConverter.java
82
- - classpath/embulk-filter-add_time-0.1.0.jar
82
+ - classpath/embulk-filter-add_time-0.1.1.jar
83
83
  homepage: https://github.com/treasure-data/embulk-filter-add_time
84
84
  licenses:
85
85
  - Apache 2.0