This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e0934166f51 [bugfix](es-catalog)fix exception when querying ES table
(#26788)
e0934166f51 is described below
commit e0934166f5106bb0eb2abd4faecaba117dabb64e
Author: Guangdong Liu <[email protected]>
AuthorDate: Tue Nov 14 10:47:37 2023 +0800
[bugfix](es-catalog)fix exception when querying ES table (#26788)
---
.../org/apache/doris/external/elasticsearch/EsNodeInfo.java | 6 +++++-
.../apache/doris/external/elasticsearch/EsNodeInfoTest.java | 11 +++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsNodeInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsNodeInfo.java
index 1893c497348..706024c2edc 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsNodeInfo.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsNodeInfo.java
@@ -110,7 +110,11 @@ public class EsNodeInfo {
String[] scratch = seed.split(":");
int port = 80;
if (scratch.length == 3) {
- port = Integer.parseInt(scratch[2]);
+ String portStr = scratch[2];
+ if (portStr.contains("/")) {
+ portStr = portStr.substring(0, portStr.indexOf('/'));
+ }
+ port = Integer.parseInt(portStr);
}
String remoteHost = scratch[0] + ":" + scratch[1];
this.name = remoteHost;
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/EsNodeInfoTest.java
b/fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/EsNodeInfoTest.java
index e44ad9322e6..9350521b62e 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/EsNodeInfoTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/EsNodeInfoTest.java
@@ -43,4 +43,15 @@ public class EsNodeInfoTest extends EsTestCase {
}
}
}
+
+ @Test
+ public void testEsNodeInfo() {
+ EsNodeInfo node = new EsNodeInfo("0", "http://127.0.0.1:9200/");
+ Assert.assertEquals("http://127.0.0.1", node.getHost());
+ Assert.assertEquals(9200, node.getPublishAddress().getPort());
+ node = new EsNodeInfo("0", "http://127.0.0.1:9200");
+ Assert.assertEquals("http://127.0.0.1", node.getHost());
+ Assert.assertEquals(9200, node.getPublishAddress().getPort());
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]