Merge pull request #9011 from dataease/pr@dev@fixapi

fix(数据集):修复同步API数据集丢失数据
This commit is contained in:
taojinlong 2024-04-09 15:14:12 +08:00 committed by GitHub
commit 5a83fb568e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -522,7 +522,7 @@ public class ExtractDataService {
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), dataFile);
break;
}
BufferedWriter bw = new BufferedWriter(new FileWriter(dataFile));
try (BufferedWriter bw = new BufferedWriter(new FileWriter(dataFile))) {
for (String[] strings : dataList) {
String content = "";
for (int i = 0; i < strings.length; i++) {
@ -535,18 +535,22 @@ public class ExtractDataService {
bw.write(content);
bw.newLine();
}
bw.close();
} catch (Exception e) {
throw e;
}
File scriptFile = new File(root_path + datasetTable.getId() + ".sh");
scriptFile.createNewFile();
scriptFile.setExecutable(true);
BufferedWriter scriptFileBw = new BufferedWriter(new FileWriter(root_path + datasetTable.getId() + ".sh"));
try (BufferedWriter scriptFileBw = new BufferedWriter(new FileWriter(root_path + datasetTable.getId() + ".sh"))) {
scriptFileBw.write("#!/bin/sh");
scriptFileBw.newLine();
scriptFileBw.write(script);
scriptFileBw.newLine();
scriptFileBw.close();
} catch (Exception e) {
throw e;
}
try {
Process process = Runtime.getRuntime().exec(root_path + datasetTable.getId() + ".sh");