Skip to content

Commit a771a8b

Browse files
authored
Merge pull request #30 from civitaspo/v0.3.0
Ship v0.3.0
2 parents 40173ff + 9bfe1e6 commit a771a8b

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

Diff for: CHENGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.3.0 (2016-09-21)
2+
==================
3+
- [Incompatible Change] Not partitoning if files are compressed
4+
- https://github.com/civitaspo/embulk-input-hdfs/pull/27
5+
16
0.2.1 (2016-02-25)
27
==================
38
- [Fix] does not work

Diff for: README.md

+20-17
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,26 @@ int partitionSizeByOneTask = totalFileLength / approximateNumPartitions;
7777
/*
7878
...
7979
*/
80-
81-
long numPartitions;
82-
if (task.getPartition()) {
83-
if (file.canDecompress()) {
84-
numPartitions = ((fileLength - 1) / partitionSizeByOneTask) + 1;
85-
}
86-
else if (file.getCodec() != null) { // if not null, the file is compressed.
87-
numPartitions = 1;
88-
}
89-
else {
90-
numPartitions = ((fileLength - 1) / partitionSizeByOneTask) + 1;
91-
}
92-
}
93-
else {
94-
numPartitions = 1;
95-
}
96-
80+
long numPartitions = 1; // default is no partition.
81+
if (isPartitionable(task, conf, status)) { // partition: true and (decompression: false or CompressionCodec is null)
82+
numPartitions = ((status.getLen() - 1) / partitionSizeByOneTask) + 1;
83+
}
84+
85+
for (long i = 0; i < numPartitions; i++) {
86+
long start = status.getLen() * i / numPartitions;
87+
long end = status.getLen() * (i + 1) / numPartitions;
88+
if (start < end) {
89+
TargetFileInfo targetFileInfo = new TargetFileInfo.Builder()
90+
.pathString(status.getPath().toString())
91+
.start(start)
92+
.end(end)
93+
.isDecompressible(isDecompressible(task, conf, status))
94+
.isPartitionable(isPartitionable(task, conf, status))
95+
.numHeaderLines(task.getSkipHeaderLines())
96+
.build();
97+
builder.add(targetFileInfo);
98+
}
99+
}
97100
/*
98101
...
99102
*/

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ configurations {
1515
provided
1616
}
1717

18-
version = "0.2.1"
18+
version = "0.3.0"
1919

2020
sourceCompatibility = 1.7
2121
targetCompatibility = 1.7

0 commit comments

Comments
 (0)