You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/06/17 20:03:06 UTC

[GitHub] [calcite] xpleaf opened a new pull request #2033: [CALCITE-4069] Elasticsearch adapter. Optimize the process of adding count(*) to the result set.

xpleaf opened a new pull request #2033:
URL: https://github.com/apache/calcite/pull/2033


   Jira: https://issues.apache.org/jira/projects/CALCITE/issues/CALCITE-4069
   In Elasticsearch adapter, the result of count(*) will be added to the result set twice when use multiple aggregations without group by.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [calcite] XuQianJin-Stars commented on a change in pull request #2033: [CALCITE-4069] Elasticsearch adapter. Optimize the process of adding count(*) to the result set.

Posted by GitBox <gi...@apache.org>.
XuQianJin-Stars commented on a change in pull request #2033:
URL: https://github.com/apache/calcite/pull/2033#discussion_r441930568



##########
File path: elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTable.java
##########
@@ -287,11 +287,11 @@ String scriptedFieldPrefix() {
       result.add(new LinkedHashMap<>());
     }
 
-    // elastic exposes total number of documents matching a query in "/hits/total" path
-    // this can be used for simple "select count(*) from table"
-    final long total = res.searchHits().total().value();
+    if (groupBy.isEmpty() && aggregations.size() == 1) {

Review comment:
       aggregations.size() == 1  -> aggregations.size()>0 ?




----------------------------------------------------------------
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:
users@infra.apache.org