embulk 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +16 -0
- data/Gemfile +0 -1
- data/README.md +37 -19
- data/Rakefile +5 -37
- data/bin/embulk +1 -1
- data/build.gradle +178 -95
- data/embulk-core/build.gradle +1 -1
- data/embulk-core/src/main/java/org/embulk/command/Runner.java +11 -10
- data/embulk-core/src/main/java/org/embulk/config/ConfigDiff.java +26 -0
- data/embulk-core/src/main/java/org/embulk/config/ConfigInject.java +14 -0
- data/embulk-core/src/main/java/org/embulk/config/DataSourceImpl.java +2 -2
- data/embulk-core/src/main/java/org/embulk/config/DataSourceSerDe.java +4 -3
- data/embulk-core/src/main/java/org/embulk/config/TaskSerDe.java +5 -3
- data/embulk-core/src/main/java/org/embulk/config/TaskValidationException.java +1 -0
- data/embulk-core/src/main/java/org/embulk/exec/ExecutionResult.java +6 -6
- data/embulk-core/src/main/java/org/embulk/exec/GuessExecutor.java +19 -19
- data/embulk-core/src/main/java/org/embulk/exec/LocalExecutor.java +61 -36
- data/embulk-core/src/main/java/org/embulk/plugin/InjectedPluginSource.java +4 -0
- data/embulk-core/src/main/java/org/embulk/plugin/PluginManager.java +16 -1
- data/embulk-core/src/main/java/org/embulk/spi/Column.java +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/{SchemaVisitor.java → ColumnVisitor.java} +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/Exec.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/ExecSession.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/FileInputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FileInputRunner.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FileOutputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FileOutputRunner.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/FilterPlugin.java +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/GuessPlugin.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/InputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/OutputPlugin.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/PluginClassLoader.java +80 -0
- data/embulk-core/src/main/java/org/embulk/spi/Schema.java +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormatter.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/util/Filters.java +1 -1
- data/embulk-core/src/main/java/org/embulk/spi/util/LineEncoder.java +2 -2
- data/embulk-core/src/main/java/org/embulk/spi/util/PagePrinter.java +6 -6
- data/embulk-core/src/main/java/org/embulk/spi/util/Pages.java +6 -6
- data/embulk-core/src/test/java/org/embulk/GuiceBinder.java +1 -1
- data/embulk-core/src/test/java/org/embulk/plugin/MockPluginSource.java +1 -0
- data/embulk-core/src/test/java/org/embulk/spi/MockFormatterPlugin.java +2 -2
- data/embulk-core/src/test/java/org/embulk/spi/PageTestUtils.java +1 -1
- data/embulk-core/src/test/java/org/embulk/spi/TestFileInputRunner.java +3 -3
- data/embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java +4 -4
- data/embulk-docs/Makefile +178 -0
- data/embulk-docs/build.gradle +20 -0
- data/embulk-docs/make.bat +243 -0
- data/embulk-docs/push-gh-pages.sh +29 -0
- data/embulk-docs/src/conf.py +260 -0
- data/embulk-docs/src/index.rst +19 -0
- data/embulk-docs/src/release.rst +14 -0
- data/embulk-docs/src/release/release-0.1.0.rst +8 -0
- data/embulk-docs/src/release/release-0.2.0.rst +16 -0
- data/embulk-docs/src/release/release-0.2.1.rst +19 -0
- data/embulk-docs/src/release/release-0.3.0.rst +34 -0
- data/embulk-docs/src/release/release-0.3.1.rst +11 -0
- data/embulk-docs/src/release/release-0.3.2.rst +15 -0
- data/embulk-docs/src/release/release-0.4.0.rst +74 -0
- data/embulk-standards/build.gradle +0 -1
- data/embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java +2 -2
- data/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java +12 -3
- data/embulk-standards/src/main/java/org/embulk/standards/GzipFileDecoderPlugin.java +2 -2
- data/embulk-standards/src/main/java/org/embulk/standards/LocalFileInputPlugin.java +49 -26
- data/embulk-standards/src/main/java/org/embulk/standards/LocalFileOutputPlugin.java +16 -17
- data/embulk-standards/src/main/java/org/embulk/standards/NullOutputPlugin.java +4 -4
- data/embulk-standards/src/main/java/org/embulk/standards/StandardPluginModule.java +0 -1
- data/embulk-standards/src/main/java/org/embulk/standards/StdoutOutputPlugin.java +5 -5
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +2 -2
- data/lib/embulk/buffer.rb +2 -2
- data/lib/embulk/column.rb +6 -6
- data/lib/embulk/command/embulk_example.rb +1 -1
- data/lib/embulk/command/embulk_new_plugin.rb +87 -0
- data/lib/embulk/command/embulk_run.rb +84 -26
- data/lib/embulk/data/bundle/Gemfile +12 -20
- data/lib/embulk/data/bundle/embulk/{filter_example.rb → filter/example.rb} +3 -3
- data/lib/embulk/data/bundle/embulk/{input_example.rb → input/example.rb} +3 -3
- data/lib/embulk/data/bundle/embulk/{output_example.rb → output/example.rb} +3 -3
- data/lib/embulk/data/new/LICENSE.txt +21 -0
- data/lib/embulk/data/new/README.md.erb +75 -0
- data/lib/embulk/data/new/gitignore.erb +12 -0
- data/lib/embulk/data/new/java/build.gradle.erb +57 -0
- data/lib/embulk/data/new/java/decoder.java.erb +40 -0
- data/lib/embulk/data/new/java/encoder.java.erb +40 -0
- data/lib/embulk/data/new/java/file_input.java.erb +64 -0
- data/lib/embulk/data/new/java/file_output.java.erb +66 -0
- data/lib/embulk/data/new/java/filter.java.erb +47 -0
- data/lib/embulk/data/new/java/formatter.java.erb +45 -0
- data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/lib/embulk/data/new/java/gradlew +164 -0
- data/lib/embulk/data/new/java/gradlew.bat +90 -0
- data/lib/embulk/data/new/java/input.java.erb +69 -0
- data/lib/embulk/data/new/java/output.java.erb +65 -0
- data/lib/embulk/data/new/java/parser.java.erb +51 -0
- data/lib/embulk/data/new/java/plugin_loader.rb.erb +3 -0
- data/lib/embulk/data/new/java/test.java.erb +5 -0
- data/lib/embulk/data/new/ruby/Gemfile +2 -0
- data/lib/embulk/data/new/ruby/Rakefile +1 -0
- data/lib/embulk/data/new/ruby/filter.rb.erb +39 -0
- data/lib/embulk/data/new/ruby/gemspec.erb +19 -0
- data/lib/embulk/data/new/ruby/input.rb.erb +47 -0
- data/lib/embulk/data/new/ruby/output.rb.erb +59 -0
- data/lib/embulk/data/package_data.rb +64 -0
- data/lib/embulk/data_source.rb +2 -2
- data/lib/embulk/decoder_plugin.rb +27 -0
- data/lib/embulk/encoder_plugin.rb +27 -0
- data/lib/embulk/error.rb +3 -0
- data/lib/embulk/file_input_plugin.rb +27 -0
- data/lib/embulk/file_output_plugin.rb +27 -0
- data/lib/embulk/filter_plugin.rb +28 -9
- data/lib/embulk/formatter_plugin.rb +105 -0
- data/lib/embulk/guess_csv.rb +10 -1
- data/lib/embulk/guess_plugin.rb +22 -27
- data/lib/embulk/input_plugin.rb +34 -20
- data/lib/embulk/java/bootstrap.rb +5 -0
- data/lib/embulk/java/imports.rb +7 -0
- data/lib/embulk/java_plugin.rb +84 -0
- data/lib/embulk/output_plugin.rb +35 -19
- data/lib/embulk/page.rb +1 -1
- data/lib/embulk/page_builder.rb +1 -1
- data/lib/embulk/parser_plugin.rb +76 -0
- data/lib/embulk/plugin.rb +130 -65
- data/lib/embulk/plugin_registry.rb +19 -8
- data/lib/embulk/schema.rb +4 -4
- data/lib/embulk/version.rb +1 -1
- data/settings.gradle +1 -0
- metadata +123 -90
- data/ChangeLog +0 -46
- data/embulk-cli/pom.xml +0 -94
- data/embulk-core/pom.xml +0 -148
- data/embulk-core/src/main/java/org/embulk/config/NextConfig.java +0 -26
- data/embulk-standards/pom.xml +0 -68
- data/embulk-standards/src/main/java/org/embulk/standards/S3FileInputPlugin.java +0 -250
- data/embulk-standards/src/test/java/org/embulk/standards/TestS3FileInputPlugin.java +0 -43
- data/pom.xml +0 -541
@@ -11,7 +11,7 @@ import org.embulk.config.TaskSource;
|
|
11
11
|
import org.embulk.config.ConfigSource;
|
12
12
|
import org.embulk.spi.Column;
|
13
13
|
import org.embulk.spi.Schema;
|
14
|
-
import org.embulk.spi.
|
14
|
+
import org.embulk.spi.ColumnVisitor;
|
15
15
|
import org.embulk.spi.FormatterPlugin;
|
16
16
|
import org.embulk.spi.Page;
|
17
17
|
import org.embulk.spi.PageOutput;
|
@@ -78,7 +78,7 @@ public class CsvFormatterPlugin
|
|
78
78
|
{
|
79
79
|
pageReader.setPage(page);
|
80
80
|
while (pageReader.nextRecord()) {
|
81
|
-
schema.visitColumns(new
|
81
|
+
schema.visitColumns(new ColumnVisitor() {
|
82
82
|
public void booleanColumn(Column column)
|
83
83
|
{
|
84
84
|
addDelimiter(column);
|
@@ -3,6 +3,7 @@ package org.embulk.standards;
|
|
3
3
|
import com.google.common.base.Preconditions;
|
4
4
|
import com.google.common.collect.ImmutableMap;
|
5
5
|
import com.google.common.base.Optional;
|
6
|
+
import com.google.common.collect.ImmutableSet;
|
6
7
|
import org.embulk.config.Task;
|
7
8
|
import org.embulk.config.Config;
|
8
9
|
import org.embulk.config.ConfigDefault;
|
@@ -14,7 +15,7 @@ import org.embulk.spi.time.TimestampParseException;
|
|
14
15
|
import org.embulk.spi.Column;
|
15
16
|
import org.embulk.spi.Schema;
|
16
17
|
import org.embulk.spi.SchemaConfig;
|
17
|
-
import org.embulk.spi.
|
18
|
+
import org.embulk.spi.ColumnVisitor;
|
18
19
|
import org.embulk.spi.PageBuilder;
|
19
20
|
import org.embulk.spi.ParserPlugin;
|
20
21
|
import org.embulk.spi.Exec;
|
@@ -29,6 +30,14 @@ import java.util.Map;
|
|
29
30
|
public class CsvParserPlugin
|
30
31
|
implements ParserPlugin
|
31
32
|
{
|
33
|
+
private static final ImmutableSet<String> TRUE_STRINGS =
|
34
|
+
ImmutableSet.of(
|
35
|
+
"true", "True", "TRUE",
|
36
|
+
"yes", "Yes", "YES",
|
37
|
+
"y", "Y",
|
38
|
+
"on", "On", "ON",
|
39
|
+
"1");
|
40
|
+
|
32
41
|
public interface PluginTask
|
33
42
|
extends Task, LineDecoder.DecoderTask, TimestampParser.ParserTask
|
34
43
|
{
|
@@ -120,14 +129,14 @@ public class CsvParserPlugin
|
|
120
129
|
break;
|
121
130
|
}
|
122
131
|
|
123
|
-
schema.visitColumns(new
|
132
|
+
schema.visitColumns(new ColumnVisitor() {
|
124
133
|
public void booleanColumn(Column column)
|
125
134
|
{
|
126
135
|
String v = nextColumn(schema, tokenizer, nullStringOrNull);
|
127
136
|
if (v == null) {
|
128
137
|
pageBuilder.setNull(column);
|
129
138
|
} else {
|
130
|
-
pageBuilder.setBoolean(column,
|
139
|
+
pageBuilder.setBoolean(column, TRUE_STRINGS.contains(v));
|
131
140
|
}
|
132
141
|
}
|
133
142
|
|
@@ -3,10 +3,10 @@ package org.embulk.standards;
|
|
3
3
|
import java.io.InputStream;
|
4
4
|
import java.io.IOException;
|
5
5
|
import java.util.zip.GZIPInputStream;
|
6
|
-
import com.fasterxml.jackson.annotation.JacksonInject;
|
7
6
|
import org.embulk.config.Task;
|
8
7
|
import org.embulk.config.TaskSource;
|
9
8
|
import org.embulk.config.ConfigSource;
|
9
|
+
import org.embulk.config.ConfigInject;
|
10
10
|
import org.embulk.spi.DecoderPlugin;
|
11
11
|
import org.embulk.spi.BufferAllocator;
|
12
12
|
import org.embulk.spi.FileInput;
|
@@ -19,7 +19,7 @@ public class GzipFileDecoderPlugin
|
|
19
19
|
public interface PluginTask
|
20
20
|
extends Task
|
21
21
|
{
|
22
|
-
@
|
22
|
+
@ConfigInject
|
23
23
|
public BufferAllocator getBufferAllocator();
|
24
24
|
}
|
25
25
|
|
@@ -13,12 +13,14 @@ import java.nio.file.FileVisitResult;
|
|
13
13
|
import java.nio.file.attribute.BasicFileAttributes;
|
14
14
|
import javax.validation.constraints.NotNull;
|
15
15
|
import com.google.common.collect.ImmutableList;
|
16
|
-
import com.
|
16
|
+
import com.google.common.base.Optional;
|
17
17
|
import org.embulk.config.Config;
|
18
|
+
import org.embulk.config.ConfigInject;
|
19
|
+
import org.embulk.config.ConfigDefault;
|
18
20
|
import org.embulk.config.Task;
|
19
21
|
import org.embulk.config.TaskSource;
|
20
22
|
import org.embulk.config.ConfigSource;
|
21
|
-
import org.embulk.config.
|
23
|
+
import org.embulk.config.ConfigDiff;
|
22
24
|
import org.embulk.config.CommitReport;
|
23
25
|
import org.embulk.spi.BufferAllocator;
|
24
26
|
import org.embulk.spi.Exec;
|
@@ -27,34 +29,37 @@ import org.embulk.spi.TransactionalFileInput;
|
|
27
29
|
import org.embulk.spi.util.InputStreamFileInput;
|
28
30
|
import org.slf4j.Logger;
|
29
31
|
|
30
|
-
import static org.embulk.spi.util.Inputs.formatPath;
|
31
|
-
|
32
32
|
public class LocalFileInputPlugin
|
33
33
|
implements FileInputPlugin
|
34
34
|
{
|
35
35
|
public interface PluginTask
|
36
36
|
extends Task
|
37
37
|
{
|
38
|
-
@Config("
|
39
|
-
|
40
|
-
|
38
|
+
@Config("path_prefix")
|
39
|
+
public String getPathPrefix();
|
40
|
+
|
41
|
+
@Config("last_path")
|
42
|
+
@ConfigDefault("null")
|
43
|
+
public Optional<String> getLastPath();
|
41
44
|
|
42
45
|
public List<String> getFiles();
|
43
46
|
public void setFiles(List<String> files);
|
44
47
|
|
45
|
-
@
|
48
|
+
@ConfigInject
|
46
49
|
public BufferAllocator getBufferAllocator();
|
47
50
|
}
|
48
51
|
|
49
52
|
private final Logger log = Exec.getLogger(getClass());
|
50
53
|
|
51
54
|
@Override
|
52
|
-
public
|
55
|
+
public ConfigDiff transaction(ConfigSource config, FileInputPlugin.Control control)
|
53
56
|
{
|
54
57
|
PluginTask task = config.loadConfig(PluginTask.class);
|
55
58
|
|
56
59
|
// list files recursively
|
57
|
-
|
60
|
+
List<String> files = listFiles(task);
|
61
|
+
log.info("Loading files {}", files);
|
62
|
+
task.setFiles(files);
|
58
63
|
|
59
64
|
// number of processors is same with number of files
|
60
65
|
int processorCount = task.getFiles().size();
|
@@ -62,12 +67,12 @@ public class LocalFileInputPlugin
|
|
62
67
|
}
|
63
68
|
|
64
69
|
@Override
|
65
|
-
public
|
70
|
+
public ConfigDiff resume(TaskSource taskSource,
|
66
71
|
int processorCount,
|
67
72
|
FileInputPlugin.Control control)
|
68
73
|
{
|
69
74
|
control.run(taskSource, processorCount);
|
70
|
-
return Exec.
|
75
|
+
return Exec.newConfigDiff();
|
71
76
|
}
|
72
77
|
|
73
78
|
@Override
|
@@ -78,22 +83,40 @@ public class LocalFileInputPlugin
|
|
78
83
|
|
79
84
|
public List<String> listFiles(PluginTask task)
|
80
85
|
{
|
86
|
+
Path pathPrefix = Paths.get(task.getPathPrefix()).normalize();
|
87
|
+
final Path directory;
|
88
|
+
final String fileNamePrefix;
|
89
|
+
if (Files.isDirectory(pathPrefix)) {
|
90
|
+
directory = pathPrefix;
|
91
|
+
fileNamePrefix = "";
|
92
|
+
} else {
|
93
|
+
fileNamePrefix = pathPrefix.getFileName().toString();
|
94
|
+
Path d = pathPrefix.getParent();
|
95
|
+
directory = (d == null ? Paths.get(".") : d);
|
96
|
+
}
|
97
|
+
|
81
98
|
final ImmutableList.Builder<String> builder = ImmutableList.builder();
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
{
|
90
|
-
|
91
|
-
|
99
|
+
final String lastPath = task.getLastPath().orNull();
|
100
|
+
try {
|
101
|
+
log.info("Listing local files at directory '{}' filtering filename by prefix '{}'", directory, fileNamePrefix);
|
102
|
+
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
|
103
|
+
@Override
|
104
|
+
public FileVisitResult visitFile(Path path, BasicFileAttributes aAttrs)
|
105
|
+
{
|
106
|
+
if (lastPath == null || path.toString().compareTo(lastPath) > 0) {
|
107
|
+
if (path.getParent().equals(directory)) {
|
108
|
+
if (path.getFileName().toString().startsWith(fileNamePrefix)) {
|
109
|
+
builder.add(path.toString());
|
110
|
+
}
|
111
|
+
} else {
|
112
|
+
builder.add(path.toString());
|
113
|
+
}
|
92
114
|
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
115
|
+
return FileVisitResult.CONTINUE;
|
116
|
+
}
|
117
|
+
});
|
118
|
+
} catch (IOException ex) {
|
119
|
+
throw new RuntimeException(String.format("Failed get a list of local files at '%s'", directory), ex);
|
97
120
|
}
|
98
121
|
return builder.build();
|
99
122
|
}
|
@@ -8,8 +8,9 @@ import java.io.OutputStream;
|
|
8
8
|
import java.util.ArrayList;
|
9
9
|
import java.util.List;
|
10
10
|
import org.embulk.config.Config;
|
11
|
+
import org.embulk.config.ConfigDefault;
|
11
12
|
import org.embulk.config.ConfigSource;
|
12
|
-
import org.embulk.config.
|
13
|
+
import org.embulk.config.ConfigDiff;
|
13
14
|
import org.embulk.config.CommitReport;
|
14
15
|
import org.embulk.config.Task;
|
15
16
|
import org.embulk.config.TaskSource;
|
@@ -25,38 +26,38 @@ public class LocalFileOutputPlugin
|
|
25
26
|
public interface PluginTask
|
26
27
|
extends Task
|
27
28
|
{
|
28
|
-
@Config("
|
29
|
-
public String
|
30
|
-
|
31
|
-
@Config("file_name")
|
32
|
-
public String getFileNameFormat();
|
29
|
+
@Config("path_prefix")
|
30
|
+
public String getPathPrefix();
|
33
31
|
|
34
32
|
@Config("file_ext")
|
35
33
|
public String getFileNameExtension();
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
@Config("sequence_format")
|
36
|
+
@ConfigDefault("\".%03d.%02d\"")
|
37
|
+
public String getSequenceFormat();
|
40
38
|
}
|
41
39
|
|
42
40
|
private final Logger log = Exec.getLogger(getClass());
|
43
41
|
|
44
42
|
@Override
|
45
|
-
public
|
43
|
+
public ConfigDiff transaction(ConfigSource config, int processorCount,
|
46
44
|
FileOutputPlugin.Control control)
|
47
45
|
{
|
48
46
|
PluginTask task = config.loadConfig(PluginTask.class);
|
49
47
|
|
48
|
+
// validate sequence_format
|
49
|
+
String.format(task.getSequenceFormat(), 0, 0);
|
50
|
+
|
50
51
|
return resume(task.dump(), processorCount, control);
|
51
52
|
}
|
52
53
|
|
53
54
|
@Override
|
54
|
-
public
|
55
|
+
public ConfigDiff resume(TaskSource taskSource,
|
55
56
|
int processorCount,
|
56
57
|
FileOutputPlugin.Control control)
|
57
58
|
{
|
58
59
|
control.run(taskSource);
|
59
|
-
return Exec.
|
60
|
+
return Exec.newConfigDiff();
|
60
61
|
}
|
61
62
|
|
62
63
|
@Override
|
@@ -70,11 +71,9 @@ public class LocalFileOutputPlugin
|
|
70
71
|
{
|
71
72
|
PluginTask task = taskSource.loadTask(PluginTask.class);
|
72
73
|
|
73
|
-
|
74
|
-
final String fileName = task.getFileNameFormat();
|
75
|
-
|
76
|
-
final String pathPrefix = task.getDirectory() + File.separator + fileName;
|
74
|
+
final String pathPrefix = task.getPathPrefix();
|
77
75
|
final String pathSuffix = task.getFileNameExtension();
|
76
|
+
final String sequenceFormat = task.getSequenceFormat();
|
78
77
|
|
79
78
|
final List<String> fileNames = new ArrayList<>();
|
80
79
|
|
@@ -85,7 +84,7 @@ public class LocalFileOutputPlugin
|
|
85
84
|
public void nextFile()
|
86
85
|
{
|
87
86
|
closeFile();
|
88
|
-
String path = pathPrefix + String.format(
|
87
|
+
String path = pathPrefix + String.format(sequenceFormat, processorIndex, fileIndex) + pathSuffix;
|
89
88
|
log.info("Writing local file '{}'", path);
|
90
89
|
fileNames.add(path);
|
91
90
|
try {
|
@@ -3,7 +3,7 @@ package org.embulk.standards;
|
|
3
3
|
import java.util.List;
|
4
4
|
import org.embulk.config.ConfigSource;
|
5
5
|
import org.embulk.config.TaskSource;
|
6
|
-
import org.embulk.config.
|
6
|
+
import org.embulk.config.ConfigDiff;
|
7
7
|
import org.embulk.config.CommitReport;
|
8
8
|
import org.embulk.spi.Schema;
|
9
9
|
import org.embulk.spi.Page;
|
@@ -15,19 +15,19 @@ public class NullOutputPlugin
|
|
15
15
|
implements OutputPlugin
|
16
16
|
{
|
17
17
|
@Override
|
18
|
-
public
|
18
|
+
public ConfigDiff transaction(ConfigSource config,
|
19
19
|
Schema schema, int processorCount,
|
20
20
|
OutputPlugin.Control control)
|
21
21
|
{
|
22
22
|
return resume(Exec.newTaskSource(), schema, processorCount, control);
|
23
23
|
}
|
24
24
|
|
25
|
-
public
|
25
|
+
public ConfigDiff resume(TaskSource taskSource,
|
26
26
|
Schema schema, int processorCount,
|
27
27
|
OutputPlugin.Control control)
|
28
28
|
{
|
29
29
|
control.run(taskSource);
|
30
|
-
return Exec.
|
30
|
+
return Exec.newConfigDiff();
|
31
31
|
}
|
32
32
|
|
33
33
|
public void cleanup(TaskSource taskSource,
|
@@ -22,7 +22,6 @@ public class StandardPluginModule
|
|
22
22
|
|
23
23
|
// input plugins
|
24
24
|
registerPluginTo(binder, InputPlugin.class, "file", LocalFileInputPlugin.class);
|
25
|
-
registerPluginTo(binder, InputPlugin.class, "s3_file", S3FileInputPlugin.class);
|
26
25
|
|
27
26
|
// parser plugins
|
28
27
|
registerPluginTo(binder, ParserPlugin.class, "csv", CsvParserPlugin.class);
|
@@ -3,12 +3,12 @@ package org.embulk.standards;
|
|
3
3
|
import java.util.List;
|
4
4
|
import org.embulk.config.ConfigSource;
|
5
5
|
import org.embulk.config.TaskSource;
|
6
|
-
import org.embulk.config.
|
6
|
+
import org.embulk.config.ConfigDiff;
|
7
7
|
import org.embulk.config.CommitReport;
|
8
8
|
import org.embulk.config.Task;
|
9
9
|
import org.embulk.spi.time.TimestampFormatter;
|
10
10
|
import org.embulk.spi.Schema;
|
11
|
-
import org.embulk.spi.
|
11
|
+
import org.embulk.spi.ColumnVisitor;
|
12
12
|
import org.embulk.spi.Column;
|
13
13
|
import org.embulk.spi.Page;
|
14
14
|
import org.embulk.spi.Exec;
|
@@ -26,7 +26,7 @@ public class StdoutOutputPlugin
|
|
26
26
|
}
|
27
27
|
|
28
28
|
@Override
|
29
|
-
public
|
29
|
+
public ConfigDiff transaction(ConfigSource config,
|
30
30
|
Schema schema, int processorCount,
|
31
31
|
OutputPlugin.Control control)
|
32
32
|
{
|
@@ -35,12 +35,12 @@ public class StdoutOutputPlugin
|
|
35
35
|
}
|
36
36
|
|
37
37
|
@Override
|
38
|
-
public
|
38
|
+
public ConfigDiff resume(TaskSource taskSource,
|
39
39
|
Schema schema, int processorCount,
|
40
40
|
OutputPlugin.Control control)
|
41
41
|
{
|
42
42
|
control.run(taskSource);
|
43
|
-
return Exec.
|
43
|
+
return Exec.newConfigDiff();
|
44
44
|
}
|
45
45
|
|
46
46
|
public void cleanup(TaskSource taskSource,
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#Wed
|
1
|
+
#Wed Feb 04 13:46:12 PST 2015
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
3
3
|
distributionPath=wrapper/dists
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
|
data/lib/embulk/buffer.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
module Embulk
|
3
3
|
class Buffer < String
|
4
4
|
if Embulk.java?
|
5
|
-
def self.
|
5
|
+
def self.from_java(java_buffer)
|
6
6
|
byte_list = org.jruby.util.ByteList.new(java_buffer.array(), java_buffer.offset(), java_buffer.limit(), false)
|
7
7
|
buffer = new
|
8
8
|
buffer.replace(org.jruby.RubyString.new(JRuby.runtime, self, byte_list).dup) # TODO simplify
|
9
9
|
buffer
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def to_java
|
13
13
|
Java::Buffer.wrap(to_java_bytes)
|
14
14
|
end
|
15
15
|
end
|
data/lib/embulk/column.rb
CHANGED
@@ -6,26 +6,26 @@ module Embulk
|
|
6
6
|
end
|
7
7
|
|
8
8
|
if Embulk.java?
|
9
|
-
def self.
|
9
|
+
def self.from_java(java_column)
|
10
10
|
Column.new(
|
11
11
|
java_column.getIndex,
|
12
12
|
java_column.getName,
|
13
|
-
Type.
|
13
|
+
Type.from_java(java_column.getType))
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
Java::Column.new(index, name, Type.
|
16
|
+
def to_java
|
17
|
+
Java::Column.new(index, name, Type.new_java_type(type))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
module Type
|
23
23
|
if Embulk.java?
|
24
|
-
def self.
|
24
|
+
def self.from_java(java_type)
|
25
25
|
java_type.getName.to_sym
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.
|
28
|
+
def self.new_java_type(ruby_type)
|
29
29
|
case ruby_type
|
30
30
|
when :boolean
|
31
31
|
Java::Types::BOOLEAN
|