-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Conversation
3f2c588
to
c0561f0
Compare
c5e4a1a
to
344426b
Compare
344426b
to
ebe4d57
Compare
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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()
There was a problem hiding this 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.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/EsQueryExec.java
Outdated
Show resolved
Hide resolved
...in/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LocalPhysicalPlanOptimizer.java
Outdated
Show resolved
Hide resolved
...e-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/TSDBRestEsqlIT.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
public EsQueryExec( | ||
Source source, | ||
EsIndex index, | ||
IndexMode indexMode, |
There was a problem hiding this comment.
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.
@martijnvg @kkrik-es @bpintea Thanks for reviewing. |
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.