Skip to content

Commit 3233f0d

Browse files
committed
fix non-stats query
1 parent 1fde41d commit 3233f0d

File tree

1 file changed

+3
-2
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/approximate

1 file changed

+3
-2
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/approximate/Approximate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public void onResponse(Result result) {
386386
cluster -> cluster.getFailures().stream().anyMatch(e -> e.getCause() instanceof UnsupportedOperationException)
387387
);
388388
if (esStatsQueryExecuted) {
389-
logger.debug("not approximating stats query");
389+
logger.debug("stats query succeeded; returning exact result");
390390
listener.onResponse(result);
391391
} else {
392392
result.pages().forEach(Page::close);
@@ -396,9 +396,10 @@ public void onResponse(Result result) {
396396

397397
@Override
398398
public void onFailure(Exception e) {
399-
if (e instanceof UnsupportedOperationException) {
399+
if (e.getCause() instanceof UnsupportedOperationException) {
400400
runner.run(toPhysicalPlan.apply(sourceCountPlan()), configuration, foldContext, sourceCountListener(listener));
401401
} else {
402+
logger.debug("stats query failed; returning error");
402403
listener.onFailure(e);
403404
}
404405
}

0 commit comments

Comments
 (0)