Skip to content

Commit

Permalink
Using FsUtils instead of Files API to extract file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
n3nash authored and prazanna committed Jun 30, 2017
1 parent e5d9b81 commit 348250d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import com.google.common.io.Files;
import com.uber.hoodie.common.table.HoodieTimeline;
import com.uber.hoodie.common.util.FSUtils;
import org.apache.hadoop.fs.FileStatus;

import java.io.Serializable;
import java.util.Objects;
import java.util.Optional;

/**
* A Hoodie Instant represents a action done on a hoodie dataset.
Expand All @@ -42,11 +42,11 @@ public class HoodieInstant implements Serializable {
public HoodieInstant(FileStatus fileStatus) {
// First read the instant timestamp. [==>20170101193025<==].commit
String fileName = fileStatus.getPath().getName();
String fileExtension = Files.getFileExtension(fileName);
timestamp = fileName.replace("." + fileExtension, "");
String fileExtension = FSUtils.getFileExtension(fileName);
timestamp = fileName.replace(fileExtension, "");

// Next read the action for this marker
action = fileExtension;
action = fileExtension.replaceFirst(".", "");
if(action.equals("inflight")) {
// This is to support backwards compatibility on how in-flight commit files were written
// General rule is inflight extension is .<action>.inflight, but for commit it is .inflight
Expand Down

0 comments on commit 348250d

Please sign in to comment.