embulk-output-td 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/build.gradle +1 -1
- data/embulk-output-td.gemspec +1 -1
- data/src/main/java/org/embulk/output/td/TdOutputPlugin.java +2 -1
- data/src/test/java/org/embulk/output/td/TestTdOutputPlugin.java +37 -0
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe85fa7501f82e0d7660c88ef9369629fe91827
|
4
|
+
data.tar.gz: 9858b8eea57c1574c346d919dd9a57ba7ea44058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 602fa7e84ed8e32444a6de50ceeb8333ba071e7ba546dbb46424a8e7c20ebdc21cd67705031e29fe602db1f5bd9a50b6bc08f682507aedef986b2d6741e6a20e
|
7
|
+
data.tar.gz: 1960a94319e23a719273853bdffcd3151caa3cfe053bcdab45c5f70fe419a0650dcc07cb77a9ff495e9bea8aff7f3bd40e7c538fe3d9260eadffa08f387b2c2c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
|
2
|
+
## 0.5.2 - 2019-10-24
|
3
|
+
* [maintenance] Fix columns order bug described in issue [91](https://github.com/treasure-data/embulk-output-td/issues/91) [#92](https://github.com/treasure-data/embulk-output-td/pull/92)
|
4
|
+
|
1
5
|
## 0.5.1 - 2018-04-24
|
2
6
|
* [maintenance] Upgrade td-client-java v0.8.4 [#88](https://github.com/treasure-data/embulk-output-td/pull/88)
|
3
7
|
|
data/build.gradle
CHANGED
data/embulk-output-td.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-output-td"
|
4
|
-
spec.version = "0.5.
|
4
|
+
spec.version = "0.5.2"
|
5
5
|
spec.authors = ["Muga Nishizawa"]
|
6
6
|
spec.summary = %[TreasureData output plugin for Embulk]
|
7
7
|
spec.description = %[TreasureData output plugin is an Embulk plugin that loads records to TreasureData read by any input plugins. Search the input plugins by 'embulk-output' keyword.]
|
@@ -2,6 +2,7 @@ package org.embulk.output.td;
|
|
2
2
|
|
3
3
|
import java.io.IOException;
|
4
4
|
import java.io.InputStream;
|
5
|
+
import java.util.LinkedHashMap;
|
5
6
|
import java.util.List;
|
6
7
|
import java.util.ArrayList;
|
7
8
|
import java.util.Map;
|
@@ -691,7 +692,7 @@ public class TdOutputPlugin
|
|
691
692
|
String databaseName = task.getDatabase();
|
692
693
|
TDTable table = findTable(client, databaseName, task.getTable());
|
693
694
|
|
694
|
-
final Map<String, TDColumnType> guessedSchema = new
|
695
|
+
final Map<String, TDColumnType> guessedSchema = new LinkedHashMap<>();
|
695
696
|
inputSchema.visitColumns(new ColumnVisitor() {
|
696
697
|
public void booleanColumn(Column column)
|
697
698
|
{
|
@@ -9,6 +9,7 @@ import com.treasuredata.client.TDClientHttpConflictException;
|
|
9
9
|
import com.treasuredata.client.TDClientHttpNotFoundException;
|
10
10
|
import com.treasuredata.client.model.TDBulkImportSession;
|
11
11
|
import com.treasuredata.client.model.TDBulkImportSession.ImportStatus;
|
12
|
+
import com.treasuredata.client.model.TDColumn;
|
12
13
|
import com.treasuredata.client.model.TDColumnType;
|
13
14
|
import com.treasuredata.client.model.TDTable;
|
14
15
|
import com.treasuredata.client.model.TDTableType;
|
@@ -23,6 +24,7 @@ import org.embulk.output.td.TdOutputPlugin.HttpProxyTask;
|
|
23
24
|
import org.embulk.output.td.TdOutputPlugin.TimestampColumnOption;
|
24
25
|
import org.embulk.output.td.TdOutputPlugin.UnixTimestampUnit;
|
25
26
|
import org.embulk.output.td.writer.FieldWriterSet;
|
27
|
+
import org.embulk.spi.Column;
|
26
28
|
import org.embulk.spi.Exec;
|
27
29
|
import org.embulk.spi.ExecSession;
|
28
30
|
import org.embulk.spi.OutputPlugin;
|
@@ -34,8 +36,10 @@ import org.embulk.spi.type.Types;
|
|
34
36
|
import org.junit.Before;
|
35
37
|
import org.junit.Rule;
|
36
38
|
import org.junit.Test;
|
39
|
+
import org.mockito.ArgumentCaptor;
|
37
40
|
import org.slf4j.Logger;
|
38
41
|
|
42
|
+
import java.util.ArrayList;
|
39
43
|
import java.util.HashMap;
|
40
44
|
import java.util.List;
|
41
45
|
|
@@ -52,9 +56,11 @@ import static org.junit.Assert.fail;
|
|
52
56
|
import static org.mockito.Matchers.any;
|
53
57
|
import static org.mockito.Matchers.anyInt;
|
54
58
|
import static org.mockito.Matchers.anyString;
|
59
|
+
import static org.mockito.Mockito.doAnswer;
|
55
60
|
import static org.mockito.Mockito.doNothing;
|
56
61
|
import static org.mockito.Mockito.doReturn;
|
57
62
|
import static org.mockito.Mockito.doThrow;
|
63
|
+
import static org.mockito.Mockito.mock;
|
58
64
|
import static org.mockito.Mockito.spy;
|
59
65
|
|
60
66
|
public class TestTdOutputPlugin
|
@@ -540,6 +546,37 @@ public class TestTdOutputPlugin
|
|
540
546
|
// Expect no error happens.
|
541
547
|
}
|
542
548
|
|
549
|
+
@Test
|
550
|
+
public void testUpdateSchemaWillPreserveIndex()
|
551
|
+
{
|
552
|
+
final String dbName = "test_db";
|
553
|
+
final String tblName = "test_tbl";
|
554
|
+
PluginTask task = mock(PluginTask.class);
|
555
|
+
doReturn(dbName).when(task).getDatabase();
|
556
|
+
doReturn(tblName).when(task).getTable();
|
557
|
+
doReturn(tblName).when(task).getLoadTargetTableName();
|
558
|
+
|
559
|
+
TDTable table = mock(TDTable.class);
|
560
|
+
|
561
|
+
TDClient client = mock(TDClient.class);
|
562
|
+
doReturn(table).when(client).showTable(anyString(), anyString());
|
563
|
+
|
564
|
+
Schema schema = schema("col3", Types.LONG, "col0", Types.STRING, "col1", Types.STRING);
|
565
|
+
|
566
|
+
// capture param of client append schema to check for columns order
|
567
|
+
ArgumentCaptor<List<TDColumn>> schemaCaptor = ArgumentCaptor.forClass((Class) List.class);
|
568
|
+
doNothing().when(client).appendTableSchema(anyString(), anyString(), schemaCaptor.capture());
|
569
|
+
|
570
|
+
plugin.updateSchema(client, schema,task);
|
571
|
+
|
572
|
+
List<Column> inputCols = schema.getColumns();
|
573
|
+
List<TDColumn> uploadedCols = schemaCaptor.getValue();
|
574
|
+
|
575
|
+
assertEquals(inputCols.get(0).getName(), uploadedCols.get(0).getName());
|
576
|
+
assertEquals(inputCols.get(1).getName(), uploadedCols.get(1).getName());
|
577
|
+
assertEquals(inputCols.get(2).getName(), uploadedCols.get(2).getName());
|
578
|
+
}
|
579
|
+
|
543
580
|
public static ConfigSource config()
|
544
581
|
{
|
545
582
|
return Exec.newConfigSource()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muga Nishizawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,21 +83,21 @@ files:
|
|
83
83
|
- src/test/java/org/embulk/output/td/TestTdOutputPlugin.java
|
84
84
|
- src/test/java/org/embulk/output/td/TestTimeValueGenerator.java
|
85
85
|
- src/test/java/org/embulk/output/td/writer/TestFieldWriterSet.java
|
86
|
-
- classpath/embulk-output-td-0.5.1.jar
|
87
|
-
- classpath/guava-21.0.jar
|
88
|
-
- classpath/hamcrest-core-1.1.jar
|
89
|
-
- classpath/jackson-annotations-2.8.1.jar
|
90
|
-
- classpath/jackson-core-2.8.1.jar
|
91
|
-
- classpath/jackson-databind-2.8.1.jar
|
92
|
-
- classpath/jackson-datatype-guava-2.8.1.jar
|
93
|
-
- classpath/jackson-datatype-json-org-2.8.1.jar
|
94
86
|
- classpath/json-20090211_1.jar
|
95
|
-
- classpath/
|
87
|
+
- classpath/jackson-datatype-guava-2.8.1.jar
|
96
88
|
- classpath/junit-4.10.jar
|
89
|
+
- classpath/jackson-annotations-2.8.1.jar
|
97
90
|
- classpath/okhttp-3.9.0.jar
|
91
|
+
- classpath/guava-21.0.jar
|
98
92
|
- classpath/okhttp-urlconnection-3.9.0.jar
|
99
|
-
- classpath/
|
93
|
+
- classpath/json-simple-1.1.1.jar
|
94
|
+
- classpath/jackson-core-2.8.1.jar
|
95
|
+
- classpath/jackson-databind-2.8.1.jar
|
96
|
+
- classpath/hamcrest-core-1.1.jar
|
97
|
+
- classpath/jackson-datatype-json-org-2.8.1.jar
|
100
98
|
- classpath/td-client-0.8.4.jar
|
99
|
+
- classpath/embulk-output-td-0.5.2.jar
|
100
|
+
- classpath/okio-1.13.0.jar
|
101
101
|
homepage: https://github.com/treasure-data/embulk-output-td
|
102
102
|
licenses:
|
103
103
|
- Apache 2.0
|