Skip to content
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: Remove remaining IT_tests_only #108434

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/reference/esql/processing-commands/enrich.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ in this example). `ENRICH` will look for records in the

[source.merge.styled,esql]
----
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich]
include::{esql-specs}/enrich.csv-spec[tag=enrich]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich-result]
include::{esql-specs}/enrich.csv-spec[tag=enrich-result]
|===

To use a column with a different name than the `match_field` defined in the
policy as the match field, use `ON <column-name>`:

[source.merge.styled,esql]
----
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_on]
include::{esql-specs}/enrich.csv-spec[tag=enrich_on]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_on-result]
include::{esql-specs}/enrich.csv-spec[tag=enrich_on-result]
|===

By default, each of the enrich fields defined in the policy is added as a
Expand All @@ -82,22 +82,22 @@ column. To explicitly select the enrich fields that are added, use

[source.merge.styled,esql]
----
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_with]
include::{esql-specs}/enrich.csv-spec[tag=enrich_with]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_with-result]
include::{esql-specs}/enrich.csv-spec[tag=enrich_with-result]
|===

You can rename the columns that are added using `WITH new_name=<field1>`:

[source.merge.styled,esql]
----
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_rename]
include::{esql-specs}/enrich.csv-spec[tag=enrich_rename]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs-IT_tests_only.csv-spec[tag=enrich_rename-result]
include::{esql-specs}/enrich.csv-spec[tag=enrich_rename-result]
|===

In case of name collisions, the newly created columns will override existing
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,31 @@ median_duration:double | env:keyword
simple
required_feature: esql.enrich_load

row language_code = "1"
| enrich languages_policy
// tag::enrich[]
ROW language_code = "1"
| ENRICH languages_policy
// end::enrich[]
;

// tag::enrich-result[]
language_code:keyword | language_name:keyword
1 | English
// end::enrich-result[]
;

enrichOnSimple
required_feature: esql.enrich_load

// tag::enrich_on[]
ROW a = "1"
| ENRICH languages_policy ON a
// end::enrich_on[]
;

// tag::enrich_on-result[]
a:keyword | language_name:keyword
1 | English
// end::enrich_on-result[]
;


Expand Down Expand Up @@ -83,6 +102,22 @@ emp_no:integer | x:keyword | language_name:keyword
;


withSimple
required_feature: esql.enrich_load

// tag::enrich_with[]
ROW a = "1"
| ENRICH languages_policy ON a WITH language_name
// end::enrich_with[]
;

// tag::enrich_with-result[]
a:keyword | language_name:keyword
1 | English
// end::enrich_with-result[]
;


withAlias
required_feature: esql.enrich_load

Expand All @@ -95,6 +130,21 @@ emp_no:integer | x:keyword | lang:keyword
10003 | 4 | German
;

withAliasSimple
required_feature: esql.enrich_load

// tag::enrich_rename[]
ROW a = "1"
| ENRICH languages_policy ON a WITH name = language_name
// end::enrich_rename[]
;

// tag::enrich_rename-result[]
a:keyword | name:keyword
1 | English
// end::enrich_rename-result[]
;


withAliasSort
required_feature: esql.enrich_load
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
import static org.elasticsearch.xpack.ql.CsvSpecReader.specParser;
import static org.elasticsearch.xpack.ql.TestUtils.classpathResources;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

Expand Down Expand Up @@ -144,7 +146,6 @@
public class CsvTests extends ESTestCase {

private static final Logger LOGGER = LogManager.getLogger(CsvTests.class);
private static final String IGNORED_CSV_FILE_NAMES_PATTERN = "-IT_tests_only";

private final String fileName;
private final String groupName;
Expand All @@ -164,10 +165,8 @@ public class CsvTests extends ESTestCase {

@ParametersFactory(argumentFormatting = "%2$s.%3$s")
public static List<Object[]> readScriptSpec() throws Exception {
List<URL> urls = classpathResources("/*.csv-spec").stream()
.filter(x -> x.toString().contains(IGNORED_CSV_FILE_NAMES_PATTERN) == false)
.toList();
assertTrue("Not enough specs found " + urls, urls.size() > 0);
List<URL> urls = classpathResources("/*.csv-spec");
assertThat("Not enough specs found " + urls, urls, hasSize(greaterThan(0)));
return SpecReader.readScriptSpec(urls, specParser());
}

Expand Down
Loading