in spark-load/spark-load-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/DppUtils.java [249:298]
public static List<String> parseColumnsFromPath(String filePath, List<String> columnsFromPath)
throws SparkDppException {
if (columnsFromPath == null || columnsFromPath.isEmpty()) {
return Collections.emptyList();
}
String[] strings = filePath.split("/");
if (strings.length < 2) {
System.err.println("Fail to parse columnsFromPath, expected: " + columnsFromPath
+ ", filePath: " + filePath);
throw new SparkDppException("Reason: Fail to parse columnsFromPath, expected: "
+ columnsFromPath + ", filePath: " + filePath);
}
String[] columns = new String[columnsFromPath.size()];
int size = 0;
for (int i = strings.length - 2; i >= 0; i--) {
String str = strings[i];
if (str != null && str.isEmpty()) {
continue;
}
if (str == null || !str.contains("=")) {
System.err.println("Fail to parse columnsFromPath, expected: " + columnsFromPath
+ ", filePath: " + filePath);
throw new SparkDppException("Reason: Fail to parse columnsFromPath, expected: "
+ columnsFromPath + ", filePath: " + filePath);
}
String[] pair = str.split("=", 2);
if (pair.length != 2) {
System.err.println("Fail to parse columnsFromPath, expected: " + columnsFromPath
+ ", filePath: " + filePath);
throw new SparkDppException("Reason: Fail to parse columnsFromPath, expected: "
+ columnsFromPath + ", filePath: " + filePath);
}
int index = columnsFromPath.indexOf(pair[0]);
if (index == -1) {
continue;
}
columns[index] = pair[1];
size++;
if (size >= columnsFromPath.size()) {
break;
}
}
if (size != columnsFromPath.size()) {
System.err.println("Fail to parse columnsFromPath, expected: " + columnsFromPath
+ ", filePath: " + filePath);
throw new SparkDppException("Reason: Fail to parse columnsFromPath, expected: "
+ columnsFromPath + ", filePath: " + filePath);
}
return Lists.newArrayList(columns);
}