Skip to content

Commit a2a6e9f

Browse files
committed
Re-create & First Commit
1 parent e706eb8 commit a2a6e9f

File tree

12 files changed

+96
-421
lines changed

12 files changed

+96
-421
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
/classpath/
77
build/
88
.idea
9+
/.settings/
10+
/.metadata/
11+
.classpath
12+
.project
913
*.iml

README.md

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,35 @@ This plugin combine rows from file having data format like a table, based on a c
1010

1111
* **on**:
1212
* **in_column**: name of the column on input. (string, required)
13-
* **file_column**: name of the column on file. (string, default is the same as **in_column**)
13+
* **file_column**: name of the column on file. (string, required)
1414
* **file**:
15-
* **path**: path of file (string, required)
16-
* **format**: file format (string, required, supported: `json`)
17-
* **encode**: file encode (string, default is `raw`, supported: `raw`, `gzip`)
15+
* **path_prefix**: Path prefix of input files (string, required)
16+
* **parser**: Parser configurations (see below [Supported Parser Type](#supported-parser-type)) (hash, required)
17+
* **decoders**: Decoder configuration (see below [Supported Decorder Type](#supported-decorder-type)) (array of hash, optional)
18+
* **follow_symlinks**: If true, follow symbolic link directories (boolean, default: `false`)
1819
* **columns**: required columns of data from the file (array of hash, required)
1920
* **name**: name of the column
20-
* **type**: type of the column (see below)
21+
* **type**: type of the column (see below [Type of the column](#type-of-the-column))
2122
* **format**: format of the timestamp if type is timestamp
22-
* **timezone**: timezone of the timestamp if type is timestamp
23+
* **timezone**: timezone of the timestamp if type is timestamp
24+
* **joined_column_prefix**: prefix added to joined column name for prevent duplicating column name (string, default: `"_joined_by_embulk_""`)
2325

24-
---
25-
**type of the column**
26+
### Supported Parser Type
27+
28+
* You can use all embulk file-parser plugins.
29+
* [built-in parser plugins](http://www.embulk.org/docs/built-in.html)
30+
* [parser plugins](http://www.embulk.org/plugins/#file-parser).
31+
* Special Configuration which [embulk-filter-join_file](.) can set in **parser** section.
32+
* **columns_option_name**: Set the **file.columns** value to the option which this option indicates. (optional, default: `"columns"`)
33+
* **join_file_columns_option_name**: Same as the **columns_option_name** option. Use this if a parser plugin has **columns_option_name** as its owned option.
34+
35+
### Supported Decorder Type
36+
37+
* You can use all embulk file-decorder plugins.
38+
* [built-in decorder plugins](http://www.embulk.org/docs/built-in.html)
39+
* [decorder plugins](http://www.embulk.org/plugins/#file-decoder)
40+
41+
### Type of the column
2642

2743
|name|description|
2844
|:---|:---|
@@ -39,47 +55,30 @@ This plugin combine rows from file having data format like a table, based on a c
3955
filters:
4056
- type: join_file
4157
on:
42-
in_column: name_id
58+
in_column: id
4359
file_column: id
4460
file:
45-
path: ./master.json
46-
format: json
47-
encode: raw
61+
path_prefix: ./example/json_array_of_hash/*.json
62+
parser:
63+
type: jsonpath
64+
root: "$."
4865
columns:
4966
- {name: id, type: long}
5067
- {name: name, type: string}
68+
- {name: created_at, type: timestamp, format: "%Y-%m-%d"}
69+
- {name: point, type: double}
70+
- {name: time_zone, type: string}
5171
joined_column_prefix: _joined_by_embulk_
5272
```
5373
74+
See [more examples](./example).
75+
5476
## Run Example
5577
5678
```
5779
$ ./gradlew classpath
58-
$ embulk run -I lib example/config.yml
59-
```
60-
61-
## Supported Data Format
62-
* json
63-
64-
### Supported Data Format Example
65-
66-
#### JSON
67-
68-
```
69-
[
70-
{
71-
"id": 0,
72-
"name": "civitaspo"
73-
},
74-
{
75-
"id": 2,
76-
"name": "moriogai"
77-
},
78-
{
79-
"id": 5,
80-
"name": "natsume.soseki"
81-
}
82-
]
80+
$ embulk bundle install --gemfile=example/Gemfile --path vendor/bundle
81+
$ embulk run -b example -Ilib example/config.yml
8382
```
8483

8584
## Build

build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ configurations {
1414
}
1515

1616
version = "0.1.0"
17+
1718
sourceCompatibility = 1.7
1819
targetCompatibility = 1.7
1920

2021
dependencies {
21-
compile "org.embulk:embulk-core:0.8.+"
22-
provided "org.embulk:embulk-core:0.8.+"
22+
compile "org.embulk:embulk-core:0.8.29"
23+
provided "org.embulk:embulk-core:0.8.29"
2324
testCompile "junit:junit:4.+"
2425
}
2526

@@ -46,6 +47,7 @@ task checkstyle(type: Checkstyle) {
4647
classpath = sourceSets.main.output + sourceSets.test.output
4748
source = sourceSets.main.allJava + sourceSets.test.allJava
4849
}
50+
4951
task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
5052
jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
5153
script "${project.name}.gemspec"
@@ -57,9 +59,11 @@ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
5759
script "pkg/${project.name}-${project.version}.gem"
5860
}
5961

60-
task "package"(dependsOn: ["gemspec", "classpath"]) << {
61-
println "> Build succeeded."
62-
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
62+
task "package"(dependsOn: ["gemspec", "classpath"]) {
63+
doLast {
64+
println "> Build succeeded."
65+
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
66+
}
6367
}
6468

6569
task gemspec {

example/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'embulk-parser-jsonpath'

example/config.yml renamed to example/json_array_of_hash/config.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,22 @@ in:
1616

1717
filters:
1818
- type: join_file
19-
base_column: {name: id, type: long}
20-
counter_column: {name: id, type: long}
19+
on:
20+
in_column: id
21+
file_column: id
22+
file:
23+
path_prefix: ./example/json_array_of_hash/*.json
24+
parser:
25+
type: jsonpath
26+
root: "$."
27+
columns:
28+
- {name: id, type: long}
29+
- {name: name, type: string}
30+
- {name: created_at, type: timestamp, format: "%Y-%m-%d"}
31+
- {name: point, type: double}
32+
- {name: time_zone, type: string}
2133
joined_column_prefix: _joined_by_embulk_
22-
file_path: example/master.json
23-
file_format: json
24-
columns:
25-
- {name: id, type: long}
26-
- {name: name, type: string}
27-
- {name: created_at, type: timestamp, format: "%Y-%m-%d"}
28-
- {name: point, type: double}
29-
- {name: time_zone, type: string}
34+
3035

3136
out:
3237
type: stdout
File renamed without changes.

gradle/wrapper/gradle-wrapper.jar

-1.38 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Wed Jun 21 00:12:09 JST 2017
1+
#Sun Jan 08 00:35:58 PST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22

33
##############################################################################
44
##
@@ -154,19 +154,16 @@ if $cygwin ; then
154154
esac
155155
fi
156156

157-
# Escape application args
158-
save ( ) {
159-
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160-
echo " "
157+
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158+
function splitJvmOpts() {
159+
JVM_OPTS=("$@")
161160
}
162-
APP_ARGS=$(save "$@")
163-
164-
# Collect all arguments for the java command, following the shell quoting and substitution rules
165-
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
161+
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162+
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
166163

167164
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
165+
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
169166
cd "$(dirname "$0")"
170167
fi
171168

172-
exec "$JAVACMD" "$@"
169+
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

0 commit comments

Comments
 (0)