@@ -211,9 +211,12 @@ public interface LogicalPlanRunner {
211211 */
212212 private static final Set <Class <? extends EsqlScalarFunction >> MULTIVALUED_OUTPUT_FUNCTIONS = Set .of (MvAppend .class );
213213
214- // TODO: find a good default value, or alternative ways of setting it
214+ // TODO: set via a query setting; and find a good default value
215215 private static final int SAMPLE_ROW_COUNT = 100000 ;
216216
217+ // TODO: set via a query setting
218+ private static final double CONFIDENCE_LEVEL = 0.90 ;
219+
217220 /**
218221 * The number of times (trials) the sampled rows are divided into buckets.
219222 */
@@ -474,8 +477,8 @@ private long rowCount(Result countResult) {
474477 * BY group
475478 * | WHERE `s$0` IS NOT NULL AND ... AND `s$T*B-1` IS NOT NULL
476479 * | EVAL t = s*s, `t$0` = `s$0`*`s$0`, ..., `t$T*B-1` = `s$T*B-1`*`s$T*B-1`
477- * | EVAL `CONFIDENCE_INTERVAL(s)` = CONFIDENCE_INTERVAL(s, MV_APPEND(`s$0`, ... `s$T*B-1`), T, B, 0.95 ),
478- * `CONFIDENCE_INTERVAL(t)` = CONFIDENCE_INTERVAL(t, MV_APPEND(`t$0`, ... `t$T*B-1`), T, B, 0.95 )
480+ * | EVAL `CONFIDENCE_INTERVAL(s)` = CONFIDENCE_INTERVAL(s, MV_APPEND(`s$0`, ... `s$T*B-1`), T, B, 0.90 ),
481+ * `CONFIDENCE_INTERVAL(t)` = CONFIDENCE_INTERVAL(t, MV_APPEND(`t$0`, ... `t$T*B-1`), T, B, 0.90 )
479482 * | KEEP s, t, `CONFIDENCE_INTERVAL(s)`, `CONFIDENCE_INTERVAL(t)`
480483 * }
481484 * </pre>
@@ -637,7 +640,7 @@ private LogicalPlan approximatePlan(double sampleProbability) {
637640
638641 Expression trialCount = Literal .integer (Source .EMPTY , TRIAL_COUNT );
639642 Expression bucketCount = Literal .integer (Source .EMPTY , BUCKET_COUNT );
640- Expression confidenceLevel = Literal .fromDouble (Source .EMPTY , 0.95 );
643+ Expression confidenceLevel = Literal .fromDouble (Source .EMPTY , CONFIDENCE_LEVEL );
641644
642645 // Compute the confidence interval for all output fields that have buckets.
643646 List <Alias > confidenceIntervalsAndReliable = new ArrayList <>();
0 commit comments