You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "NobiGo (via GitHub)" <gi...@apache.org> on 2024/12/11 10:50:32 UTC
Re: [PR] [CALCITE-6725] The caching mechanism key in ElasticsearchSchemaFactory is affected by the order of hosts [calcite]
NobiGo commented on code in PR #4085:
URL: https://github.com/apache/calcite/pull/4085#discussion_r1879822186
##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java:
##########
@@ -151,6 +151,7 @@ public ElasticsearchSchemaFactory() {
hosts =
coordinates.entrySet()
.stream()
+ .sorted(Map.Entry.comparingByKey(String::compareTo))
Review Comment:
Does the implementation in line 144 have the same problem?
##########
elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java:
##########
@@ -771,4 +771,24 @@ private static Consumer<ResultSet> sortedResultSetChecker(String column,
"state=AR; EXPR$1=3; EXPR$2=3");
}
+ @Test
+ void testSortHosts() {
+ Map<String, Integer> hosts = new HashMap<>();
+ hosts.put("192.168.1.150",8080);
+ hosts.put("192.168.1.110",6080);
+ hosts.put("192.168.1.120",8080);
+
+
+ List<HttpHost> sortedHosts = hosts.entrySet()
Review Comment:
This testing method and the specific implementation are independent, so I think this testing method is invalid.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org