-
Notifications
You must be signed in to change notification settings - Fork 178
Merge OpenSearchPagedIndexScan and OpenSearchIndexScan #1600
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
Merge OpenSearchPagedIndexScan and OpenSearchIndexScan #1600
Conversation
Unit tests pass, some integration tests fail. Signed-off-by: MaxKsyunz <[email protected]>
Signed-off-by: MaxKsyunz <[email protected]>
10000 is default query size set in `integ-test/build.gradle` Previous request builder wasn't setting size correctly for explain requests so output didn't match what was executed. Signed-off-by: MaxKsyunz <[email protected]>
Paginated response no longer sends an empty last page. Last page of the response now lacks cursor property. This matches legacy behaviour. Signed-off-by: MaxKsyunz <[email protected]>
Signed-off-by: MaxKsyunz <[email protected]>
When OpenSearchScrollRequest.needClean is true, the object represents the last request. Signed-off-by: MaxKsyunz <[email protected]>
3a9c6e0 to
91cea61
Compare
Signed-off-by: MaxKsyunz <[email protected]>
Codecov Report
@@ Coverage Diff @@
## feature/pagination/integ #1600 +/- ##
==============================================================
- Coverage 98.16% 97.22% -0.94%
- Complexity 3306 4217 +911
==============================================================
Files 287 381 +94
Lines 8174 10596 +2422
Branches 552 727 +175
==============================================================
+ Hits 8024 10302 +2278
- Misses 147 287 +140
- Partials 3 7 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: MaxKsyunz <[email protected]>
- Rename `getQuerySize` to `getMaxResponseSize` to reflect what the value means. - Create ExecutableRequestBuilder interface -- what OpenSearchIndexScan requires from a request builder. - Remove `PushDownRequestBuilder` interface as unnecessary Signed-off-by: MaxKsyunz <[email protected]>
Signed-off-by: MaxKsyunz <[email protected]>
Refactoring fixed a small bug in explain. Previously, explain output did not show the correct `SearchSourceBuilder.size` value . It now does and this affected some tests. Signed-off-by: MaxKsyunz <[email protected]>
- Inlined `OpenSearchIndexScan.create` that was only used in tests. - Changed Function parameter of `OpenSearchIndexScanBuilder` to an abstract method -- better describes intent. - Renamed PushDownTranslator to PushDownQueryBuilder for better consistency. Signed-off-by: MaxKsyunz <[email protected]>
Signed-off-by: MaxKsyunz <[email protected]>
Old name doesn't quite make sense. Signed-off-by: MaxKsyunz <[email protected]>
core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/planner/logical/LogicalFetchCursor.java
Outdated
Show resolved
Hide resolved
|
|
||
| @EqualsAndHashCode(callSuper = false) | ||
| @ToString | ||
| public class LogicalFetchCursor extends LogicalPlan { |
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.
javadoc?
core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/planner/optimizer/LogicalPlanOptimizer.java
Show resolved
Hide resolved
…lanDSL.java Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: Max Ksyunz <[email protected]>
…lanNodeVisitor.java Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: Max Ksyunz <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: Max Ksyunz <[email protected]>
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchScrollRequest.java
Outdated
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchScrollRequest.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchScrollRequest.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/OpenSearchIndexScan.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/OpenSearchIndexScan.java
Show resolved
Hide resolved
...n/java/org/opensearch/sql/opensearch/storage/scan/OpenSearchIndexScanAggregationBuilder.java
Show resolved
Hide resolved
plugin/src/main/java/org/opensearch/sql/plugin/config/OpenSearchPluginModule.java
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/planner/ExternalizablePlanTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java
Show resolved
Hide resolved
Signed-off-by: MaxKsyunz <[email protected]>
acarbonetto
left a comment
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.
Please respond to Chen/Peng on this:
OpenSearchIndex.java
| relation, tableScanBuilder, write, tableWriteBuilder, filter, aggregation, rename, project, | ||
| remove, eval, sort, dedup, window, rareTopN, highlight, mlCommons, ad, ml, paginate, nested | ||
| remove, eval, sort, dedup, window, rareTopN, highlight, mlCommons, ad, ml, paginate, nested, | ||
| cursor |
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: we should split this test up for each LogicalPlan node
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 merged this recently to avoid duplicating code in tests...
| assertEquals( | ||
| project(pagedTableScanBuilder), | ||
| LogicalPlanOptimizer.create().optimize(paginate(project(relation), 4))); | ||
| assertEquals(project(tableScanBuilder), optimized); |
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: we should check pagesize of 4 explicitly
or is this done already?
| var builder = new OpenSearchRequestBuilder( | ||
| settings.getSettingValue(Settings.Key.QUERY_SIZE_LIMIT), | ||
| new OpenSearchExprValueFactory(allFields)); | ||
| return new OpenSearchIndexScanBuilder(builder) { |
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.
Signed-off-by: MaxKsyunz <[email protected]>
Add comment and remove unused default constructor. Signed-off-by: MaxKsyunz <[email protected]>
|
Please, update PR description - for example, you don't have |
Yury-Fridlyand
left a comment
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.
LGFM
Last few minor things left.
Signed-off-by: MaxKsyunz <[email protected]>
High-level Summary
Core Module
PushDownPageSizeoptimization rule toLogicalPlanOptimizer.TableScanBuilder.pushDownPageSizemethod.Table.createPagedScanBuilder.CreatePagingTableScanBuilder.opensearch Module
OpenSearchIndexScanQueryBuilderandOpenSearchIndexScanAggregationBuilderby removing index scan dependency.OpenSearchScrollRequest.toCursordoes not generate a cursor if the request needs to be cleaned up -- means OpenSearch will not send any more data.ExecutableRequestBuilderinterface that represents operations of an executable request. Used byOpenSearchIndexScan.ContinuePageRequestto only implementExecutableRequestBuilder.InitialPageRequestBuilder,OpenSearchPagedIndexScan,OpenSearchPagedIndexScanBuilder,PagedRequestBuilder,PushDownRequestBuilderIssues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.