|
24 | 24 | import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
|
25 | 25 | import org.apache.seatunnel.connectors.seatunnel.file.config.BaseSourceConfig;
|
26 | 26 | import org.apache.seatunnel.connectors.seatunnel.file.config.HadoopConf;
|
27 |
| -import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorErrorCode; |
28 |
| -import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorException; |
29 | 27 | import org.apache.seatunnel.connectors.seatunnel.file.sink.util.FileSystemUtils;
|
30 | 28 |
|
31 | 29 | import org.apache.hadoop.conf.Configuration;
|
@@ -153,15 +151,9 @@ public List<String> getFileNamesByPath(HadoopConf hadoopConf, String path) throw
|
153 | 151 | }
|
154 | 152 | }
|
155 | 153 | }
|
156 |
| - |
157 |
| - if (fileNames.isEmpty()) { |
158 |
| - throw new FileConnectorException( |
159 |
| - FileConnectorErrorCode.FILE_LIST_EMPTY, |
160 |
| - "The target file list is empty," |
161 |
| - + "SeaTunnel will not be able to sync empty table, " |
162 |
| - + "please check the configuration parameters such as: [file_filter_pattern]"); |
| 154 | + if (this.fileNames.isEmpty()) { |
| 155 | + log.error("The current directory is empty " + path); |
163 | 156 | }
|
164 |
| - |
165 | 157 | return fileNames;
|
166 | 158 | }
|
167 | 159 |
|
@@ -196,10 +188,12 @@ public SeaTunnelRowType getActualSeaTunnelRowTypeInfo() {
|
196 | 188 |
|
197 | 189 | protected Map<String, String> parsePartitionsByPath(String path) {
|
198 | 190 | LinkedHashMap<String, String> partitions = new LinkedHashMap<>();
|
199 |
| - Arrays.stream(path.split("/", -1)) |
200 |
| - .filter(split -> split.contains("=")) |
201 |
| - .map(split -> split.split("=", -1)) |
202 |
| - .forEach(kv -> partitions.put(kv[0], kv[1])); |
| 191 | + if (path != null && !path.isEmpty()) { |
| 192 | + Arrays.stream(path.split("/", -1)) |
| 193 | + .filter(split -> split.contains("=")) |
| 194 | + .map(split -> split.split("=", -1)) |
| 195 | + .forEach(kv -> partitions.put(kv[0], kv[1])); |
| 196 | + } |
203 | 197 | return partitions;
|
204 | 198 | }
|
205 | 199 |
|
|
0 commit comments