-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Reuse prod code and reduce EsqlSession public surface #132728
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
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| new EsqlQueryRequest(), | ||
| new EsqlExecutionInfo(randomBoolean()), | ||
| planRunner(bigArrays, foldCtx, physicalOperationProviders), | ||
| session.optimizedPlan(preOptimized), |
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.
This is same as org.elasticsearch.xpack.esql.session.EsqlSession#optimizeAndExecute except it did not call preMapper.preMapper.
Lets test production code instead of its test copy.
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.
The preMapper part wasn't an issue with the CsvTests so far, since full text function tests aren't run part of this suite. (Still, great to have this part fixed!)
| } | ||
|
|
||
| // visible for testing in CsvTests | ||
| public void optimizeAndExecute( |
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 wish this could be protected or default visibility, however CsvTests are in different package.
I wonder if in future it would be possible to extend EsqlSession in CsvTests, override analyzedPlan with custom test resolution and reduce visibility of this method.
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.
The tests can make a TestEsqlSession inside of the same package. Right?
| private LogicalPlan optimizedPlan(LogicalPlan logicalPlan) { | ||
| if (logicalPlan.preOptimized() == false) { | ||
| throw new IllegalStateException("Expected pre-optimized plan"); | ||
| } |
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.
(here and in physicalPlan(..))
This is now private and we control the order of invocations in EsqlSession.
Should we convert those exceptions into assertions?
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'm fine keeping these as hard if statements unless we see a problem on the benchmarks. It'd be bad to mess up the ordering. Not likely, but whatever.
| } | ||
|
|
||
| // visible for testing in CsvTests | ||
| public void optimizeAndExecute( |
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.
The tests can make a TestEsqlSession inside of the same package. Right?
| private LogicalPlan optimizedPlan(LogicalPlan logicalPlan) { | ||
| if (logicalPlan.preOptimized() == false) { | ||
| throw new IllegalStateException("Expected pre-optimized plan"); | ||
| } |
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'm fine keeping these as hard if statements unless we see a problem on the benchmarks. It'd be bad to mess up the ordering. Not likely, but whatever.
| listener.delegateFailureAndWrap( | ||
| // Wrap so we can capture the warnings in the calling thread |
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.
Why are we not using delegateFailureAndWrap anymore? (Naive question)
This reverts commit f8b2b3b.
Today CsvTests in order to run tests re-implemented a flow present in EsqlSession (except missing
preMapperstep).This change replaces this copy with a call to
EsqlSession#optimizeAndExecuteas well as making several methods private that are no longer need broad visibility by CsvTests.