in backup-core/src/main/java/org/apache/iotdb/backup/core/service/CsvFileValidationForPipelineService.java [40:73]
public void dataValidateWithServer(
String path, Session session, String charset, ValidationType type) throws Exception {
File fi = validateFilePath(path);
long size = fi.length();
if (size >= 200 * 1024 * 1024) {
throw new FileTransFormationException("the max supported file size is 200MB");
}
if (!fi.getName().endsWith(".csv")) {
throw new FileTransFormationException("given file is not a csv file");
}
CsvFileTransParser parser = new CsvFileTransParser(fi, charset);
List<CSVRecord> allList = new ArrayList<>();
List<CSVRecord> batchList = new ArrayList();
try {
while ((batchList = parser.nextBatchRecords(10000)).size() != 0) {
allList.addAll(batchList);
}
} catch (Exception e) {
} finally {
parser.close();
}
if (allList.size() == 0) {
return;
}
List<String> parserHeader = parser.csvParser.getHeaderNames();
List<String> timeseries = new ArrayList<>();
timeseries.addAll(parserHeader);
timeseries.remove("Time");
String deviceName = timeseries.get(0).substring(0, timeseries.get(0).lastIndexOf("."));
Map<String, String> headMap = this.getFiledTypeMap(timeseries);
doDataValidation(allList, timeseries, headMap, session, type);
}