Skip to content

Commit

Permalink
Merge pull request #30 from civitaspo/v0.3.0
Browse files Browse the repository at this point in the history
Ship v0.3.0
  • Loading branch information
civitaspo authored Sep 21, 2016
2 parents 40173ff + 9bfe1e6 commit a771a8b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHENGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.3.0 (2016-09-21)
==================
- [Incompatible Change] Not partitoning if files are compressed
- https://github.com/civitaspo/embulk-input-hdfs/pull/27

0.2.1 (2016-02-25)
==================
- [Fix] does not work
Expand Down
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,26 @@ int partitionSizeByOneTask = totalFileLength / approximateNumPartitions;
/*
...
*/

long numPartitions;
if (task.getPartition()) {
if (file.canDecompress()) {
numPartitions = ((fileLength - 1) / partitionSizeByOneTask) + 1;
}
else if (file.getCodec() != null) { // if not null, the file is compressed.
numPartitions = 1;
}
else {
numPartitions = ((fileLength - 1) / partitionSizeByOneTask) + 1;
}
}
else {
numPartitions = 1;
}

long numPartitions = 1; // default is no partition.
if (isPartitionable(task, conf, status)) { // partition: true and (decompression: false or CompressionCodec is null)
numPartitions = ((status.getLen() - 1) / partitionSizeByOneTask) + 1;
}

for (long i = 0; i < numPartitions; i++) {
long start = status.getLen() * i / numPartitions;
long end = status.getLen() * (i + 1) / numPartitions;
if (start < end) {
TargetFileInfo targetFileInfo = new TargetFileInfo.Builder()
.pathString(status.getPath().toString())
.start(start)
.end(end)
.isDecompressible(isDecompressible(task, conf, status))
.isPartitionable(isPartitionable(task, conf, status))
.numHeaderLines(task.getSkipHeaderLines())
.build();
builder.add(targetFileInfo);
}
}
/*
...
*/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ configurations {
provided
}

version = "0.2.1"
version = "0.3.0"

sourceCompatibility = 1.7
targetCompatibility = 1.7
Expand Down

0 comments on commit a771a8b

Please sign in to comment.