Skip to content

Commit

Permalink
Fix gcsFS copyToLocal to precreate local destination directory (#5890)
Browse files Browse the repository at this point in the history
  • Loading branch information
laxmanchekka authored Aug 18, 2020
1 parent 41dc432 commit a7f7f46
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import org.apache.commons.io.FileUtils;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.filesystem.PinotFS;
import org.slf4j.Logger;
Expand Down Expand Up @@ -325,6 +326,7 @@ public String[] listFiles(URI fileUri, boolean recursive) throws IOException {
@Override
public void copyToLocalFile(URI srcUri, File dstFile) throws Exception {
LOGGER.info("Copy {} to local {}", srcUri, dstFile.getAbsolutePath());
FileUtils.forceMkdir(dstFile.getParentFile());
Blob blob = getBlob(srcUri);
checkState(existsBlob(blob), "File '%s' does not exists", srcUri);
blob.downloadTo(dstFile.toPath());
Expand Down

0 comments on commit a7f7f46

Please sign in to comment.