Skip to content

Conversation

@GalLalouche
Copy link
Contributor

@GalLalouche GalLalouche commented Jan 30, 2025

This PR adds support for METADATA _index in our unit tests (CsvTests). To that end, I added a new, refined capability specifically for that field: index_metadata_field.

@GalLalouche GalLalouche added >test Issues or PRs that are addressing/adding tests Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Jan 30, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

private Block extractBlockForSingleDoc(DocBlock docBlock, String columnName, TestBlockCopier blockCopier) {
var indexId = docBlock.asVector().shards().getInt(0);
var indexPage = indexPages.get(indexId);
if (IndexResolver.INDEX_METADATA_FIELD.contains(columnName)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way IndexResolver.INDEX_METADATA_FIELD is defined is a bit trappy, since if that set is ever going to be extended, this might match too much. I guess that's defined as a set for convenience, but the name is then misleading. Don't know if it'd be worth it extracting the _index name into a constant (used in MetadataAttribute too) and matching exactly?
Anyways, can also be left as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've defined the constant in MetadataAttribute.

@GalLalouche GalLalouche merged commit 2838dbb into elastic:main Feb 2, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 121261

GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Feb 2, 2025
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Feb 3, 2025
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Feb 17, 2025
* ESQL: Support for _index metadata field in CsvTests

* Extract INDEX constant to MetadataAttribute

* Add comment on capability
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Feb 18, 2025
* ESQL: Support for _index metadata field in CsvTests

* Extract INDEX constant to MetadataAttribute

* Add comment on capability
elasticsearchmachine pushed a commit that referenced this pull request Feb 18, 2025
#121261, #122607) (#122805)

* ESQL: Support for _index metadata field in CsvTests (#121261)

* ESQL: Support for _index metadata field in CsvTests

* Extract INDEX constant to MetadataAttribute

* Add comment on capability

* ESQL: Initial support for unmapped fields (#119886)

This PR adds initial support for unmapped fields, using the INSIST clause. For starters, this unmapped fields without a cast.
Note that the INSIST keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function. As this is currently under development, the actual syntax is INSIST_🐔.

First stage of #120072.

Specifically, the following features are implemented in this PR:

* Support for INSIST keyword without a cast. In particular, if the type being INSISTed upon is mapped to anything other than KEYWORD, it will result in an InvalidMappedField. There is no support for union type resolution on top of INSIST. Future PRs will handle these conflicts. There is support for multiple parameters, or INSIST on top of INSIST which is equivalent.
* Enforcing that INSIST must always be on top of a FROM or another INSIST. While this may change in the future, e.g., handling cases like `FROM foo | EVAL x = 1 | INSIST bar` will not be done in this PR, as it makes handling INSIST too complicated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged backport pending Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants