embulk-output-td 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/build.gradle +9 -8
  4. data/embulk-output-td.gemspec +1 -1
  5. data/src/main/java/org/embulk/output/td/MsgpackGZFileBuilder.java +11 -12
  6. data/src/main/java/org/embulk/output/td/RecordWriter.java +4 -7
  7. data/src/main/java/org/embulk/output/td/TdOutputPlugin.java +89 -84
  8. data/src/main/java/org/embulk/output/td/writer/FieldWriterSet.java +9 -0
  9. data/src/main/java/org/embulk/output/td/writer/JsonFieldWriter.java +23 -0
  10. data/src/test/java/org/embulk/output/td/TestRecordWriter.java +37 -38
  11. data/src/test/java/org/embulk/output/td/TestTdOutputPlugin.java +53 -49
  12. metadata +9 -30
  13. data/src/main/java/com/treasuredata/api/TdApiClient.java +0 -506
  14. data/src/main/java/com/treasuredata/api/TdApiClientConfig.java +0 -79
  15. data/src/main/java/com/treasuredata/api/TdApiConflictException.java +0 -10
  16. data/src/main/java/com/treasuredata/api/TdApiConstants.java +0 -10
  17. data/src/main/java/com/treasuredata/api/TdApiException.java +0 -20
  18. data/src/main/java/com/treasuredata/api/TdApiExecutionException.java +0 -10
  19. data/src/main/java/com/treasuredata/api/TdApiExecutionInterruptedException.java +0 -16
  20. data/src/main/java/com/treasuredata/api/TdApiExecutionTimeoutException.java +0 -18
  21. data/src/main/java/com/treasuredata/api/TdApiNotFoundException.java +0 -10
  22. data/src/main/java/com/treasuredata/api/TdApiResponseException.java +0 -32
  23. data/src/main/java/com/treasuredata/api/model/TDArrayColumnType.java +0 -80
  24. data/src/main/java/com/treasuredata/api/model/TDBulkImportSession.java +0 -157
  25. data/src/main/java/com/treasuredata/api/model/TDColumn.java +0 -129
  26. data/src/main/java/com/treasuredata/api/model/TDColumnType.java +0 -23
  27. data/src/main/java/com/treasuredata/api/model/TDColumnTypeDeserializer.java +0 -128
  28. data/src/main/java/com/treasuredata/api/model/TDDatabase.java +0 -49
  29. data/src/main/java/com/treasuredata/api/model/TDDatabaseList.java +0 -24
  30. data/src/main/java/com/treasuredata/api/model/TDMapColumnType.java +0 -88
  31. data/src/main/java/com/treasuredata/api/model/TDPrimitiveColumnType.java +0 -61
  32. data/src/main/java/com/treasuredata/api/model/TDTable.java +0 -64
  33. data/src/main/java/com/treasuredata/api/model/TDTableList.java +0 -33
  34. data/src/main/java/com/treasuredata/api/model/TDTablePermission.java +0 -50
  35. data/src/main/java/com/treasuredata/api/model/TDTableSchema.java +0 -44
  36. data/src/main/java/com/treasuredata/api/model/TDTableType.java +0 -37
  37. data/src/test/java/com/treasuredata/api/TestTdApiClient.java +0 -79
@@ -1,61 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- public enum TDPrimitiveColumnType
4
- implements TDColumnType
5
- {
6
- INT("int"),
7
- LONG("long"),
8
- FLOAT("float"),
9
- DOUBLE("double"),
10
- BOOLEAN("boolean"),
11
- STRING("string");
12
-
13
- private String name;
14
-
15
- private TDPrimitiveColumnType(String name)
16
- {
17
- this.name = name;
18
- }
19
-
20
- @Override
21
- public String toString()
22
- {
23
- return name;
24
- }
25
-
26
- @Override
27
- public boolean isPrimitive()
28
- {
29
- return true;
30
- }
31
-
32
- @Override
33
- public boolean isArrayType()
34
- {
35
- return false;
36
- }
37
-
38
- @Override
39
- public boolean isMapType()
40
- {
41
- return false;
42
- }
43
-
44
- @Override
45
- public TDPrimitiveColumnType asPrimitiveType()
46
- {
47
- return this;
48
- }
49
-
50
- @Override
51
- public TDArrayColumnType asArrayType()
52
- {
53
- return null;
54
- }
55
-
56
- @Override
57
- public TDMapColumnType asMapType()
58
- {
59
- return null;
60
- }
61
- }
@@ -1,64 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- import com.fasterxml.jackson.annotation.JsonCreator;
4
- import com.fasterxml.jackson.annotation.JsonProperty;
5
- import com.google.common.base.Objects;
6
-
7
- import java.util.List;
8
-
9
- public class TDTable
10
- {
11
- private String name;
12
- private TDTableType type;
13
- private List<TDColumn> columns;
14
-
15
- @JsonCreator
16
- public TDTable(
17
- @JsonProperty("name") String name,
18
- @JsonProperty("type") TDTableType type,
19
- @JsonProperty("schema") String schema)
20
- {
21
- this.name = name;
22
- this.type = type;
23
- this.columns = TDColumn.parseTuple(schema);
24
- }
25
-
26
- @JsonProperty
27
- public String getName()
28
- {
29
- return name;
30
- }
31
-
32
- @JsonProperty
33
- public TDTableType getType()
34
- {
35
- return type;
36
- }
37
-
38
- @JsonProperty
39
- public List<TDColumn> getColumns()
40
- {
41
- return columns;
42
- }
43
-
44
- @Override
45
- public boolean equals(Object obj)
46
- {
47
- if (this == obj) {
48
- return true;
49
- }
50
- if (obj == null || getClass() != obj.getClass()) {
51
- return false;
52
- }
53
- TDTable other = (TDTable) obj;
54
- return Objects.equal(this.name, other.name) &&
55
- Objects.equal(this.type, other.type) &&
56
- Objects.equal(this.columns, other.columns);
57
- }
58
-
59
- @Override
60
- public int hashCode()
61
- {
62
- return Objects.hashCode(name, type, columns);
63
- }
64
- }
@@ -1,33 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- import com.fasterxml.jackson.annotation.JsonCreator;
4
- import com.fasterxml.jackson.annotation.JsonProperty;
5
-
6
- import java.util.List;
7
-
8
- public class TDTableList
9
- {
10
- private String name;
11
- private List<TDTable> tables;
12
-
13
- @JsonCreator
14
- public TDTableList(
15
- @JsonProperty("name") String name,
16
- @JsonProperty("tables") List<TDTable> tables)
17
- {
18
- this.name = name;
19
- this.tables = tables;
20
- }
21
-
22
- @JsonProperty
23
- public String getName()
24
- {
25
- return name;
26
- }
27
-
28
- @JsonProperty
29
- public List<TDTable> getTables()
30
- {
31
- return tables;
32
- }
33
- }
@@ -1,50 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- import com.fasterxml.jackson.annotation.JsonProperty;
4
- import com.google.common.base.Objects;
5
-
6
- public class TDTablePermission
7
- {
8
- private boolean importable;
9
- private boolean queryable;
10
-
11
- public TDTablePermission(
12
- @JsonProperty("importable") boolean importable,
13
- @JsonProperty("queryable") boolean queryable)
14
- {
15
- this.importable = importable;
16
- this.queryable = queryable;
17
- }
18
-
19
- @JsonProperty("importable")
20
- public boolean isImportable()
21
- {
22
- return importable;
23
- }
24
-
25
- @JsonProperty("queryable")
26
- public boolean isQueryable()
27
- {
28
- return queryable;
29
- }
30
-
31
- @Override
32
- public boolean equals(Object obj)
33
- {
34
- if (this == obj) {
35
- return true;
36
- }
37
- if (obj == null || getClass() != obj.getClass()) {
38
- return false;
39
- }
40
- TDTablePermission other = (TDTablePermission) obj;
41
- return Objects.equal(this.importable, other.importable) &&
42
- Objects.equal(this.queryable, other.queryable);
43
- }
44
-
45
- @Override
46
- public int hashCode()
47
- {
48
- return Objects.hashCode(importable, queryable);
49
- }
50
- }
@@ -1,44 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- import com.fasterxml.jackson.annotation.JsonCreator;
4
- import com.fasterxml.jackson.annotation.JsonProperty;
5
- import com.google.common.base.Objects;
6
-
7
- import java.util.List;
8
-
9
- public class TDTableSchema
10
- {
11
- private List<TDColumn> columns;
12
-
13
- @JsonCreator
14
- public TDTableSchema(
15
- @JsonProperty("columns") List<TDColumn> columns)
16
- {
17
- this.columns = columns;
18
- }
19
-
20
- @JsonProperty
21
- public List<TDColumn> getColumns()
22
- {
23
- return columns;
24
- }
25
-
26
- @Override
27
- public boolean equals(Object obj)
28
- {
29
- if (this == obj) {
30
- return true;
31
- }
32
- if (obj == null || getClass() != obj.getClass()) {
33
- return false;
34
- }
35
- TDTableSchema other = (TDTableSchema) obj;
36
- return Objects.equal(this.columns, other.columns);
37
- }
38
-
39
- @Override
40
- public int hashCode()
41
- {
42
- return Objects.hashCode(columns);
43
- }
44
- }
@@ -1,37 +0,0 @@
1
- package com.treasuredata.api.model;
2
-
3
- import com.fasterxml.jackson.annotation.JsonCreator;
4
- import com.fasterxml.jackson.annotation.JsonValue;
5
- import com.fasterxml.jackson.databind.RuntimeJsonMappingException;
6
-
7
- public enum TDTableType
8
- {
9
- LOG("log"),
10
- ITEM("item");
11
-
12
- private String name;
13
-
14
- private TDTableType(String name)
15
- {
16
- this.name = name;
17
- }
18
-
19
- @JsonCreator
20
- public static TDTableType fromName(String name)
21
- {
22
- if ("log".equals(name)) {
23
- return LOG;
24
- }
25
- else if ("item".equals(name)) {
26
- return ITEM;
27
- }
28
- throw new RuntimeJsonMappingException("Unexpected string tuple to deserialize TDTableType");
29
- }
30
-
31
- @JsonValue
32
- @Override
33
- public String toString()
34
- {
35
- return name;
36
- }
37
- }
@@ -1,79 +0,0 @@
1
- package com.treasuredata.api;
2
-
3
- import com.treasuredata.api.model.TDDatabase;
4
- import org.bigtesting.fixd.ServerFixture;
5
- import org.bigtesting.fixd.core.Method;
6
- import org.junit.After;
7
- import org.junit.Before;
8
- import org.junit.Test;
9
-
10
- import java.util.List;
11
-
12
- import static org.junit.Assert.assertEquals;
13
- import static org.junit.Assert.fail;
14
-
15
- public class TestTdApiClient
16
- {
17
- private ServerFixture server;
18
- private TdApiClient client;
19
- private TdApiClientConfig clientConfig;
20
- private String apikey = "apikey";
21
-
22
- @Before
23
- public void startServer()
24
- throws Exception
25
- {
26
- server = new ServerFixture(9490);
27
- server.start();
28
- }
29
-
30
- @After
31
- public void stopServer()
32
- throws Exception
33
- {
34
- server.stop();
35
- }
36
-
37
- @Before
38
- public void startTdApiClient()
39
- throws Exception
40
- {
41
- clientConfig = new TdApiClientConfig("localhost:9490", false);
42
- client = new TdApiClient(apikey, clientConfig);
43
- client.start();
44
- }
45
-
46
- @After
47
- public void stopTdApiClient()
48
- throws Exception
49
- {
50
- client.close();
51
- }
52
-
53
- private static final String DATABASE_LIST_JSON =
54
- "{" +
55
- "\"databases\":[" +
56
- "{\"name\":\"test1\"}," +
57
- "{\"name\":\"test2\"}" +
58
- "]" +
59
- "}";
60
-
61
- @Test
62
- public void getDatabases() throws Exception
63
- {
64
- server.handle(Method.GET, "/v3/database/list").with(200, "text/json", DATABASE_LIST_JSON);
65
- List<TDDatabase> dbs = client.getDatabases();
66
- assertEquals(2, dbs.size());
67
- assertEquals("test1", dbs.get(0).getName());
68
- assertEquals("test2", dbs.get(1).getName());
69
- }
70
-
71
- @Test(expected = TdApiNotFoundException.class)
72
- public void notFoundDatabases()
73
- throws Exception
74
- {
75
- server.handle(Method.GET, "/v3/database/list").with(404, "text/json", "{\"message\":\"not found\"}");
76
- client.getDatabases();
77
- fail();
78
- }
79
- }