mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 04:45:07 -04:00
ESQL: Fix EvalBenchmark (#124736)
Fix the benchmark for `EVAL` which was failing because of a strange logging error. The benchmarks really didn't want to run when we use commons-logging. That's fine - we can use the ES logging facade thing. I also added a test to the benchmarks which should run the self-tests for `EVAL` on `gradle check`.
This commit is contained in:
parent
47454df24e
commit
7ac6e5fd3c
4 changed files with 34 additions and 5 deletions
|
@ -25,7 +25,6 @@ base {
|
|||
archivesName = 'elasticsearch-benchmarks'
|
||||
}
|
||||
|
||||
tasks.named("test").configure { enabled = false }
|
||||
tasks.named("javadoc").configure { enabled = false }
|
||||
|
||||
configurations {
|
||||
|
@ -52,8 +51,10 @@ dependencies {
|
|||
api "org.openjdk.jmh:jmh-core:$versions.jmh"
|
||||
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
|
||||
// Dependencies of JMH
|
||||
runtimeOnly 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
runtimeOnly 'net.sf.jopt-simple:jopt-simple:5.0.2'
|
||||
runtimeOnly 'org.apache.commons:commons-math3:3.6.1'
|
||||
|
||||
testImplementation(project(':test:framework'))
|
||||
}
|
||||
|
||||
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.benchmark.compute.operator;
|
|||
|
||||
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.DriverContext;
|
|||
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);
|
||||
run(operation);
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -9,8 +9,6 @@ package org.elasticsearch.xpack.esql.expression.function.scalar.convert;
|
|||
|
||||
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.DriverContext;
|
|||
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 abstract class AbstractConvertFunction extends UnaryScalarFunction {
|
|||
|
||||
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);
|
||||
|
||||
protected final DriverContext driverContext;
|
||||
private final Warnings warnings;
|
||||
|
|
Loading…
Add table
Reference in a new issue