Commit 642f276b authored by sonots's avatar sonots

Rename message_key => column_name

parent 922eae0d
...@@ -15,7 +15,7 @@ $ embulk gem install embulk-parser-none ...@@ -15,7 +15,7 @@ $ embulk gem install embulk-parser-none
## Configuration ## Configuration
- **message_key**: A column name which this plugin outputs (string, default: "message") - **column_name**: A column name which this plugin outputs (string, default: "payload")
## Example ## Example
...@@ -25,7 +25,7 @@ in: ...@@ -25,7 +25,7 @@ in:
path_prefix: example.txt path_prefix: example.txt
parser: parser:
type: none type: none
message_key: message column_name: payload
``` ```
Assume the input file (example.txt) is as following: Assume the input file (example.txt) is as following:
...@@ -39,7 +39,7 @@ then this plugin treats as: ...@@ -39,7 +39,7 @@ then this plugin treats as:
``` ```
+----------------+ +----------------+
| message:string | | payload:string |
+----------------+ +----------------+
| foo bar baz | | foo bar baz |
| foo bar baz | | foo bar baz |
...@@ -82,6 +82,7 @@ out: ...@@ -82,6 +82,7 @@ out:
Run example: Run example:
``` ```
$ embulk gem install embulk-formatter-single_value
$ ./gradlew classpath $ ./gradlew classpath
$ embulk run -I lib example.yml $ embulk run -I lib example.yml
``` ```
......
...@@ -3,12 +3,11 @@ in: ...@@ -3,12 +3,11 @@ in:
path_prefix: example.txt path_prefix: example.txt
parser: parser:
type: none type: none
message_key: message column_name: payload
out: out:
type: file type: file
path_prefix: example.txt path_prefix: example.txt
sequence_format: "" sequence_format: ""
file_ext: .out file_ext: .out
formatter: formatter:
type: csv type: single_value
quote_policy: NONE
...@@ -33,9 +33,9 @@ public class NoneParserPlugin ...@@ -33,9 +33,9 @@ public class NoneParserPlugin
public interface PluginTask public interface PluginTask
extends Task, LineDecoder.DecoderTask //, TimestampParser.Task extends Task, LineDecoder.DecoderTask //, TimestampParser.Task
{ {
@Config("message_key") @Config("column_name")
@ConfigDefault("\"message\"") @ConfigDefault("\"payload\"")
public String getMessageKey(); public String getColumnName();
} }
@Override @Override
...@@ -43,9 +43,9 @@ public class NoneParserPlugin ...@@ -43,9 +43,9 @@ public class NoneParserPlugin
{ {
PluginTask task = config.loadConfig(PluginTask.class); PluginTask task = config.loadConfig(PluginTask.class);
ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>(); ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();
final String messageKey = task.getMessageKey(); final String columnName = task.getColumnName();
columns.add(new ColumnConfig(messageKey, STRING ,config)); columns.add(new ColumnConfig(columnName, STRING ,config));
Schema schema = new SchemaConfig(columns).toSchema(); Schema schema = new SchemaConfig(columns).toSchema();
control.run(task.dump(), schema); control.run(task.dump(), schema);
...@@ -59,7 +59,7 @@ public class NoneParserPlugin ...@@ -59,7 +59,7 @@ public class NoneParserPlugin
LineDecoder lineDecoder = new LineDecoder(input,task); LineDecoder lineDecoder = new LineDecoder(input,task);
PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output); PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output);
String line = null; String line = null;
final String messageKey = task.getMessageKey(); final String columnName = task.getColumnName();
while( input.nextFile() ){ while( input.nextFile() ){
while(true){ while(true){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment