files.addAll(Arrays.asList(fs.listStatus(dirs[i].getPath())));
// We only check one file, so exit the loop when we have at least one.
if (files.size()>0) break;
}
} catch (IOException e) {
throw new HiveException("addFiles: filesystem error in check phase", e);
}
// Check if the file format of the file matches that of the table.
if (files.size() > 0) {
int fileId = 0;
boolean fileIsSequenceFile = true;
try {
SequenceFile.Reader reader = new SequenceFile.Reader(
fs, files.get(fileId).getPath(), conf);
reader.close();
} catch (IOException e) {
fileIsSequenceFile = false;
}
if (!fileIsSequenceFile && tableIsSequenceFile) {
throw new HiveException("Cannot load text files into a table stored as SequenceFile.");
}
if (fileIsSequenceFile && !tableIsSequenceFile) {
throw new HiveException("Cannot load SequenceFiles into a table stored as TextFile.");
}
}
}
if(tbd.getPartitionSpec().size() == 0) {