Skip to content

Commit

Permalink
ES|QL match operator - add check for snapshot build in test (elastic#…
Browse files Browse the repository at this point in the history
…111536)

* Check for snapshot builds for match operator tests

* Unmute test
  • Loading branch information
ioanatia authored Aug 2, 2024
1 parent 02c4949 commit d0253a6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/111282
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsRestIT
issue: https://github.com/elastic/elasticsearch/issues/111319
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
method: testMatchFilter
issue: https://github.com/elastic/elasticsearch/issues/111380
- class: org.elasticsearch.xpack.ml.integration.InferenceIngestInputConfigIT
method: testIngestWithInputFields
issue: https://github.com/elastic/elasticsearch/issues/111383
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

package org.elasticsearch.xpack.esql.plugin;

import org.elasticsearch.Build;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.esql.VerificationException;
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
import org.elasticsearch.xpack.esql.action.ColumnInfoImpl;
import org.elasticsearch.xpack.esql.action.EsqlQueryRequest;
import org.elasticsearch.xpack.esql.action.EsqlQueryResponse;
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.junit.Before;

Expand All @@ -34,6 +37,12 @@ public void setupIndex() {
createAndPopulateIndex();
}

@Override
protected EsqlQueryResponse run(EsqlQueryRequest request) {
assumeTrue("match operator available in snapshot builds only", Build.current().isSnapshot());
return super.run(request);
}

public void testSimpleWhereMatch() {
var query = """
FROM test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,14 @@ public void testWeightedAvg() {
}

public void testMatchInsideEval() throws Exception {
assumeTrue("Match operator is available just for snapshots", Build.current().isSnapshot());

assertEquals("1:36: EVAL does not support MATCH expressions", error("row title = \"brown fox\" | eval x = title match \"fox\" "));
}

public void testMatchFilter() throws Exception {
assumeTrue("Match operator is available just for snapshots", Build.current().isSnapshot());

assertEquals(
"1:63: MATCH requires a mapped index field, found [name]",
error("from test | eval name = concat(first_name, last_name) | where name match \"Anna\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.apache.lucene.search.IndexSearcher;
import org.elasticsearch.Build;
import org.elasticsearch.common.network.NetworkAddress;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.Tuple;
Expand Down Expand Up @@ -761,6 +762,8 @@ public void testMissingFieldsDoNotGetExtracted() {
* estimatedRowSize[324]
*/
public void testSingleMatchFilterPushdown() {
assumeTrue("Match operator is available just for snapshots", Build.current().isSnapshot());

var plan = plannerOptimizer.plan("""
from test
| where first_name match "Anna"
Expand Down Expand Up @@ -791,6 +794,8 @@ public void testSingleMatchFilterPushdown() {
* [_doc{f}#22], limit[1000], sort[[FieldSort[field=emp_no{f}#12, direction=ASC, nulls=LAST]]] estimatedRowSize[336]
*/
public void testMultipleMatchFilterPushdown() {
assumeTrue("Match operator is available just for snapshots", Build.current().isSnapshot());

var plan = plannerOptimizer.plan("""
from test
| where first_name match "Anna" OR first_name match "Anneke"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ setup:
path: /_query
parameters: [ method, path, parameters, capabilities ]
capabilities: [ match_operator ]
cluster_features: [ "gte_v8.16.0" ]
reason: "Match operator added in 8.16.0"
test_runner_features: [capabilities, allowed_warnings_regex]
- do:
Expand Down

0 comments on commit d0253a6

Please sign in to comment.