Skip to content

Commit 1fde41d

Browse files
committed
add TODO
1 parent 0c44a5c commit 1fde41d

File tree

1 file changed

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

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,12 @@ public void approximate(ActionListener<Result> listener) {
361361
// them come from Lucene's metadata and are computed fast. Approximation would
362362
// only slow things down in that case. When the query is not an ES stats query,
363363
// an exception is thrown and approximation is attempted.
364+
365+
// TODO: the final listener should do something with the Result's ExecutionInfo.
366+
// Right now it contains the error "UnsupportedOperationException" when it's no
367+
// ES stats query, which is bad. Furthermore, it contains the runtime of the
368+
// last executed query, while it probably should contain the total runtime
369+
// aggregated over the multiple queries executed here.
364370
runner.run(
365371
toPhysicalPlan.apply(logicalPlan),
366372
configuration.throwOnNonEsStatsQuery(true),
@@ -434,7 +440,7 @@ private ActionListener<Result> sourceCountListener(ActionListener<Result> listen
434440
double sampleProbability = sourceRowCount <= SAMPLE_ROW_COUNT ? 1.0 : (double) SAMPLE_ROW_COUNT / sourceRowCount;
435441
if (queryProperties.canIncreaseRowCount == false && sampleProbability == 1.0) {
436442
// If the query cannot increase the number of rows, and the sample probability is 1.0,
437-
// we can directly approximate without sampling.
443+
// we can directly run the original query without sampling.
438444
runner.run(toPhysicalPlan.apply(logicalPlan), configuration, foldContext, listener);
439445
} else if (queryProperties.canIncreaseRowCount == false && queryProperties.canDecreaseRowCount == false) {
440446
// If the query preserves all rows, we can directly approximate with the sample probability.

0 commit comments

Comments
 (0)