Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,10 @@ public static InputSplit[] createMRSplits(
public static int getNumFiles(List<HiveTablePartition> partitions, JobConf jobConf)
throws IOException {
int numFiles = 0;
FileSystem fs = null;
for (HiveTablePartition partition : partitions) {
StorageDescriptor sd = partition.getStorageDescriptor();
org.apache.hadoop.fs.Path inputPath = new org.apache.hadoop.fs.Path(sd.getLocation());
if (fs == null) {
fs = inputPath.getFileSystem(jobConf);
}
FileSystem fs = inputPath.getFileSystem(jobConf);
// it's possible a partition exists in metastore but the data has been removed
if (!fs.exists(inputPath)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.LogicalType;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
import org.apache.hadoop.hive.ql.io.IOConstants;
import org.apache.hadoop.hive.serde2.ColumnProjectionUtils;
import org.apache.hadoop.mapred.InputSplit;
Expand Down Expand Up @@ -342,22 +339,4 @@ public BaseStatistics getStatistics(BaseStatistics cachedStats) {
public InputSplitAssigner getInputSplitAssigner(HiveTableInputSplit[] inputSplits) {
return new LocatableInputSplitAssigner(inputSplits);
}

public int getNumFiles() throws IOException {
int numFiles = 0;
FileSystem fs = null;
for (HiveTablePartition partition : partitions) {
StorageDescriptor sd = partition.getStorageDescriptor();
Path inputPath = new Path(sd.getLocation());
if (fs == null) {
fs = inputPath.getFileSystem(jobConf.conf());
}
// it's possible a partition exists in metastore but the data has been removed
if (!fs.exists(inputPath)) {
continue;
}
numFiles += fs.listStatus(inputPath).length;
}
return numFiles;
}
}