|
32 | 32 | import org.apache.paimon.types.RowType; |
33 | 33 |
|
34 | 34 | import org.apache.commons.io.IOUtils; |
| 35 | +import org.slf4j.Logger; |
| 36 | +import org.slf4j.LoggerFactory; |
35 | 37 |
|
36 | 38 | import java.io.File; |
37 | 39 | import java.io.FileInputStream; |
|
46 | 48 | /** Manager to manage remote files for lookup. */ |
47 | 49 | public class RemoteLookupFileManager<T> implements RemoteFileDownloader { |
48 | 50 |
|
| 51 | + private static final Logger LOG = LoggerFactory.getLogger(RemoteLookupFileManager.class); |
| 52 | + |
49 | 53 | private final FileIO fileIO; |
50 | 54 | private final DataFilePathFactory pathFactory; |
51 | 55 | private final TableSchema schema; |
@@ -110,17 +114,19 @@ public boolean tryToDownload(DataFileMeta dataFile, File localFile) { |
110 | 114 | } |
111 | 115 |
|
112 | 116 | Optional<String> remoteSst = remoteSst(dataFile); |
113 | | - if (remoteSst.isPresent()) { |
114 | | - Path remoteSstPath = remoteSstPath(dataFile, remoteSst.get()); |
115 | | - try (SeekableInputStream is = fileIO.newInputStream(remoteSstPath); |
116 | | - FileOutputStream os = new FileOutputStream(localFile)) { |
117 | | - IOUtils.copy(is, os); |
118 | | - } catch (IOException e) { |
119 | | - throw new RuntimeException(e); |
120 | | - } |
| 117 | + if (!remoteSst.isPresent()) { |
| 118 | + return false; |
| 119 | + } |
| 120 | + |
| 121 | + Path remoteSstPath = remoteSstPath(dataFile, remoteSst.get()); |
| 122 | + try (SeekableInputStream is = fileIO.newInputStream(remoteSstPath); |
| 123 | + FileOutputStream os = new FileOutputStream(localFile)) { |
| 124 | + IOUtils.copy(is, os); |
121 | 125 | return true; |
| 126 | + } catch (Exception e) { |
| 127 | + LOG.warn("Failed to download remote lookup file {}, skipping.", remoteSstPath, e); |
| 128 | + return false; |
122 | 129 | } |
123 | | - return false; |
124 | 130 | } |
125 | 131 |
|
126 | 132 | private Optional<String> remoteSst(DataFileMeta file) { |
|
0 commit comments