in spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/config/DorisConfig.java [77:125]
private void checkOptions(Map<String, String> options) throws OptionRequiredException {
if (!options.containsKey(DorisOptions.DORIS_FENODES.getName())) {
throw new OptionRequiredException(DorisOptions.DORIS_FENODES.getName());
} else {
String feNodes = options.get(DorisOptions.DORIS_FENODES.getName());
if (feNodes.isEmpty()) {
throw new IllegalArgumentException("option [" + DorisOptions.DORIS_FENODES.getName() + "] is empty");
} else if (feNodes.contains(":")) {
if (!feNodes.matches("([\\w-.]+:\\d+,)*([\\w-.]+:\\d+)")) {
throw new IllegalArgumentException("option [" + DorisOptions.DORIS_FENODES.getName() + "] is not in correct format, for example: host:port[,host2:port]");
}
}
}
if (!ignoreTableCheck) {
if (!options.containsKey(DorisOptions.DORIS_TABLE_IDENTIFIER.getName())) {
throw new OptionRequiredException(DorisOptions.DORIS_TABLE_IDENTIFIER.getName());
} else {
String tableIdentifier = options.get(DorisOptions.DORIS_TABLE_IDENTIFIER.getName());
if (tableIdentifier.isEmpty()) {
throw new IllegalArgumentException("option [" + DorisOptions.DORIS_TABLE_IDENTIFIER.getName() + "] is empty");
} else if (!tableIdentifier.contains(".")) {
throw new IllegalArgumentException("option [" + DorisOptions.DORIS_TABLE_IDENTIFIER.getName() + "] is not in correct format, for example: db.table");
}
}
}
if (!options.containsKey(DorisOptions.DORIS_USER.getName())) {
throw new OptionRequiredException(DorisOptions.DORIS_USER.getName());
} else if (options.get(DorisOptions.DORIS_USER.getName()).isEmpty()) {
throw new IllegalArgumentException("option [" + DorisOptions.DORIS_USER.getName() + "] is empty");
}
if (!options.containsKey(DorisOptions.DORIS_PASSWORD.getName())) {
throw new OptionRequiredException(DorisOptions.DORIS_PASSWORD.getName());
}
if ("thrift".equalsIgnoreCase(options.get(DorisOptions.READ_MODE.getName()))) {
if (Boolean.parseBoolean(options.get(DorisOptions.DORIS_READ_BITMAP_TO_STRING.getName()))) {
throw new IllegalArgumentException(String.format("option [%s] is invalid in thrift read mode",
DorisOptions.DORIS_READ_BITMAP_TO_STRING.getName()));
}
if (Boolean.parseBoolean(options.get(DorisOptions.DORIS_READ_BITMAP_TO_BASE64.getName()))) {
throw new IllegalArgumentException(String.format("option [%s] is invalid in thrift read mode",
DorisOptions.DORIS_READ_BITMAP_TO_BASE64.getName()));
}
} else {
if (Boolean.parseBoolean(options.get(DorisOptions.DORIS_READ_BITMAP_TO_STRING.getName()))
&& Boolean.parseBoolean(options.get(DorisOptions.DORIS_READ_BITMAP_TO_BASE64.getName()))) {
throw new IllegalArgumentException("option [%s] and [%s] cannot be true at this same time");
}
}
}