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

Add index mode to esql index source #108747

Merged
merged 12 commits into from
May 23, 2024
Merged

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented May 17, 2024

This PR adds index mode to the ESQL index source. Specifically, METRICS commands will now run with TimeSeriesSortedSourceOperatorFactory. Also, it removes the time-series pragmas in favor of METRICS commands.

@dnhatn dnhatn force-pushed the time-series-source branch 5 times, most recently from 3f2c588 to c0561f0 Compare May 17, 2024 05:33
@dnhatn dnhatn force-pushed the time-series-source branch 4 times, most recently from c5e4a1a to 344426b Compare May 20, 2024 19:17
@dnhatn dnhatn requested review from bpintea and martijnvg May 21, 2024 05:36
@dnhatn dnhatn marked this pull request as ready for review May 21, 2024 05:36
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine labels May 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM from the time series side.

(The unmutes bwc tests did fail.)

if (in.getTransportVersion().onOrAfter(TransportVersions.ESQL_ADD_INDEX_MODE_TO_SOURCE)) {
int ord = in.readByte();
return switch (ord) {
case 0 -> IndexMode.STANDARD;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: make 0, 1 etc part of the enum and add checks to enforce they're distinct?

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed b07cd89 to serialize the name of the index mode instead.

}

public EsQueryExec(
Source source,
EsIndex index,
IndexMode indexMode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the mode be part of EsIndex?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I've tried that before, but the problem is that this EsIndex is used in the QL module and many other places. Let me replicate it in ESQL and add the index mode to the new EsIndex.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hope #108773 will make things simpler.

Copy link
Member Author

Choose a reason for hiding this comment

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

I gave this a try, but we create EsIndex inside IndexResolver, which depends on the field-caps responses rather than the command. I will revisit this again after we have index mode in field-caps.

public EsqlUnresolvedRelation(Source source, TableIdentifier table, List<Attribute> metadataFields, String unresolvedMessage) {
private final IndexMode indexMode;

public EsqlUnresolvedRelation(
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider providing two factory methods setting the mode, e.g. create() and createTsdb()

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

Moving the index mode in EsIndex makes sense, otherwise it LGTM.

}

public EsQueryExec(
Source source,
EsIndex index,
IndexMode indexMode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hope #108773 will make things simpler.

@dnhatn
Copy link
Member Author

dnhatn commented May 23, 2024

@martijnvg @kkrik-es @bpintea Thanks for reviewing.

@dnhatn dnhatn merged commit 4b50858 into elastic:main May 23, 2024
15 checks passed
@dnhatn dnhatn deleted the time-series-source branch May 23, 2024 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >non-issue :StorageEngine/Metrics You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants