leonardBang commented on a change in pull request #10468: [FLINK-14649][table
sql / api] Flatten all the connector properties keys to make it easy to
configure in DDL
URL: https://github.com/apache/flink/pull/10468#discussion_r355190040
##########
File path:
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/ElasticsearchValidator.java
##########
@@ -146,28 +147,32 @@ private void
validateConnectionProperties(DescriptorProperties properties) {
* <pre>
* connector.hosts = http://host_name:9092;http://host_name:9093
* </pre>
- * @param descriptorProperties
- * @return
*/
- public static List<ElasticsearchUpsertTableSinkBase.Host>
validateAndGetHostsStr(DescriptorProperties descriptorProperties) {
- final List<ElasticsearchUpsertTableSinkBase.Host> hostList =
new ArrayList<>();
+ public static List<Host>
validateAndParseHostsString(DescriptorProperties descriptorProperties) {
+ final List<Host> hostList = new ArrayList<>();
+ descriptorProperties.validateString(CONNECTOR_HOSTS, false, 1);
final String hostsStr =
descriptorProperties.getString(CONNECTOR_HOSTS);
- if (hostsStr.isEmpty()) {
- throw new ValidationException("Properties '" +
CONNECTOR_HOSTS + "' can not be empty.");
- }
final String[] hosts = hostsStr.split(";");
for (String host : hosts) {
+ final String validationExceptionMessage = "Properties
'" + CONNECTOR_HOSTS + "' format should " +
+ "follow the format
'http://host_name:port', but is '" + host + "'.";
try {
final URL url = new URL(host);
final String protocol = url.getProtocol();
- final String hostNmae = url.getHost();
+ final String hostName = url.getHost();
final int hostPort = url.getPort();
- hostList.add(new
ElasticsearchUpsertTableSinkBase.Host(hostNmae, hostPort, protocol));
+
+ if (null == protocol || protocol.isEmpty()
Review comment:
ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services