-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESQL: Fix EvalBenchmark #124736
ESQL: Fix EvalBenchmark #124736
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
import org.apache.lucene.util.BytesRef; | ||
import org.elasticsearch.common.breaker.NoopCircuitBreaker; | ||
import org.elasticsearch.common.logging.LogConfigurator; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.util.BigArrays; | ||
import org.elasticsearch.compute.data.Block; | ||
|
@@ -28,6 +29,8 @@ | |
import org.elasticsearch.compute.operator.EvalOperator; | ||
import org.elasticsearch.compute.operator.Operator; | ||
import org.elasticsearch.core.TimeValue; | ||
import org.elasticsearch.logging.LogManager; | ||
import org.elasticsearch.logging.Logger; | ||
import org.elasticsearch.xpack.esql.core.expression.Expression; | ||
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute; | ||
import org.elasticsearch.xpack.esql.core.expression.FoldContext; | ||
|
@@ -89,9 +92,16 @@ public class EvalBenchmark { | |
static final DriverContext driverContext = new DriverContext(BigArrays.NON_RECYCLING_INSTANCE, blockFactory); | ||
|
||
static { | ||
LogConfigurator.configureESLogging(); | ||
// Smoke test all the expected values and force loading subclasses more like prod | ||
selfTest(); | ||
} | ||
|
||
static void selfTest() { | ||
Logger log = LogManager.getLogger(EvalBenchmark.class); | ||
try { | ||
for (String operation : EvalBenchmark.class.getField("operation").getAnnotationsByType(Param.class)[0].value()) { | ||
log.info("self testing {}", operation); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to log something to make sure the tests really do something. I figured keeping it in the real benchmark wouldn't hurt. I did have to do the |
||
run(operation); | ||
} | ||
} catch (NoSuchFieldException e) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.benchmark.compute.operator; | ||
|
||
import org.elasticsearch.test.ESTestCase; | ||
|
||
public class EvalBenchmarkTests extends ESTestCase { | ||
public void testSelfTest() { | ||
EvalBenchmark.selfTest(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ | |
|
||
import joptsimple.internal.Strings; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.compute.data.Block; | ||
import org.elasticsearch.compute.data.Page; | ||
|
@@ -19,6 +17,8 @@ | |
import org.elasticsearch.compute.operator.EvalOperator; | ||
import org.elasticsearch.compute.operator.EvalOperator.ExpressionEvaluator; | ||
import org.elasticsearch.compute.operator.Warnings; | ||
import org.elasticsearch.logging.LogManager; | ||
import org.elasticsearch.logging.Logger; | ||
import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException; | ||
import org.elasticsearch.xpack.esql.core.expression.Expression; | ||
import org.elasticsearch.xpack.esql.core.tree.Source; | ||
|
@@ -127,7 +127,7 @@ public ExpressionEvaluator.Factory toEvaluator(ToEvaluator toEvaluator) { | |
|
||
public abstract static class AbstractEvaluator implements EvalOperator.ExpressionEvaluator { | ||
|
||
private static final Log logger = LogFactory.getLog(AbstractEvaluator.class); | ||
private static final Logger logger = LogManager.getLogger(AbstractEvaluator.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The actual fix.... |
||
|
||
protected final DriverContext driverContext; | ||
private final Warnings warnings; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this the tests don't start. It doesn't seem to hurt jmh. If it's trouble later we can deal with it.